PresenterTheme.cxx (5d03e972) PresenterTheme.cxx (45b93914)
1/**************************************************************
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance

--- 13 unchanged lines hidden (view full) ---

22
23
24// MARKER(update_precomp.py): autogen include statement, do not remove
25#include "precompiled_sdext.hxx"
26
27#include "PresenterTheme.hxx"
28#include "PresenterBitmapContainer.hxx"
29#include "PresenterCanvasHelper.hxx"
1/**************************************************************
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance

--- 13 unchanged lines hidden (view full) ---

22
23
24// MARKER(update_precomp.py): autogen include statement, do not remove
25#include "precompiled_sdext.hxx"
26
27#include "PresenterTheme.hxx"
28#include "PresenterBitmapContainer.hxx"
29#include "PresenterCanvasHelper.hxx"
30#include "PresenterComponent.hxx"
30#include "PresenterConfigurationAccess.hxx"
31#include "PresenterHelper.hxx"
32#include <com/sun/star/awt/Point.hpp>
33#include <com/sun/star/beans/UnknownPropertyException.hpp>
34#include <com/sun/star/deployment/XPackageInformationProvider.hpp>
35#include <com/sun/star/drawing/XPresenterHelper.hpp>
36#include <com/sun/star/lang/IllegalArgumentException.hpp>
37#include <com/sun/star/rendering/PanoseWeight.hpp>

--- 58 unchanged lines hidden (view full) ---

96 the configuration handling easier.
97*/
98class ReadContext
99{
100public:
101 Reference<XComponentContext> mxComponentContext;
102 Reference<rendering::XCanvas> mxCanvas;
103 Reference<drawing::XPresenterHelper> mxPresenterHelper;
31#include "PresenterConfigurationAccess.hxx"
32#include "PresenterHelper.hxx"
33#include <com/sun/star/awt/Point.hpp>
34#include <com/sun/star/beans/UnknownPropertyException.hpp>
35#include <com/sun/star/deployment/XPackageInformationProvider.hpp>
36#include <com/sun/star/drawing/XPresenterHelper.hpp>
37#include <com/sun/star/lang/IllegalArgumentException.hpp>
38#include <com/sun/star/rendering/PanoseWeight.hpp>

--- 58 unchanged lines hidden (view full) ---

97 the configuration handling easier.
98*/
99class ReadContext
100{
101public:
102 Reference<XComponentContext> mxComponentContext;
103 Reference<rendering::XCanvas> mxCanvas;
104 Reference<drawing::XPresenterHelper> mxPresenterHelper;
105 OUString msBasePath;
104
105 ReadContext (
106 const Reference<XComponentContext>& rxContext,
107 const Reference<rendering::XCanvas>& rxCanvas);
108 ~ReadContext (void);
109
110 /** Read data describing a font from the node that can be reached from
111 the given root via the given path.

--- 9 unchanged lines hidden (view full) ---

121 const PresenterTheme::SharedFontDescriptor& rpDefault);
122
123 ::boost::shared_ptr<PresenterTheme::Theme> ReadTheme (
124 PresenterConfigurationAccess& rConfiguration,
125 const OUString& rsThemeName);
126
127 BorderSize ReadBorderSize (const Reference<container::XNameAccess>& rxNode);
128
106
107 ReadContext (
108 const Reference<XComponentContext>& rxContext,
109 const Reference<rendering::XCanvas>& rxCanvas);
110 ~ReadContext (void);
111
112 /** Read data describing a font from the node that can be reached from
113 the given root via the given path.

--- 9 unchanged lines hidden (view full) ---

123 const PresenterTheme::SharedFontDescriptor& rpDefault);
124
125 ::boost::shared_ptr<PresenterTheme::Theme> ReadTheme (
126 PresenterConfigurationAccess& rConfiguration,
127 const OUString& rsThemeName);
128
129 BorderSize ReadBorderSize (const Reference<container::XNameAccess>& rxNode);
130
131 void SetBitmapSourceExtension (const OUString& rsExtensionName);
132
129private:
130 Any GetByName (
131 const Reference<container::XNameAccess>& rxNode,
132 const OUString& rsName) const;
133};
134
135
136

--- 190 unchanged lines hidden (view full) ---

327
328
329::boost::shared_ptr<PresenterTheme::Theme> PresenterTheme::ReadTheme (void)
330{
331 ReadContext aReadContext(mxContext, mxCanvas);
332
333 PresenterConfigurationAccess aConfiguration (
334 mxContext,
133private:
134 Any GetByName (
135 const Reference<container::XNameAccess>& rxNode,
136 const OUString& rsName) const;
137};
138
139
140

--- 190 unchanged lines hidden (view full) ---

331
332
333::boost::shared_ptr<PresenterTheme::Theme> PresenterTheme::ReadTheme (void)
334{
335 ReadContext aReadContext(mxContext, mxCanvas);
336
337 PresenterConfigurationAccess aConfiguration (
338 mxContext,
335 OUString::createFromAscii("/org.openoffice.Office.PresenterScreen/"),
339 OUString::createFromAscii("/org.openoffice.Office.extension.PresenterScreen/"),
336 PresenterConfigurationAccess::READ_ONLY);
337
338 return aReadContext.ReadTheme(aConfiguration, msThemeName);
339}
340
341
342
343

--- 93 unchanged lines hidden (view full) ---

437{
438 if (mpTheme.get() == NULL)
439 return ::boost::shared_ptr<PresenterConfigurationAccess>();
440
441 // Open configuration for writing.
442 ::boost::shared_ptr<PresenterConfigurationAccess> pConfiguration (
443 new PresenterConfigurationAccess(
444 mxContext,
340 PresenterConfigurationAccess::READ_ONLY);
341
342 return aReadContext.ReadTheme(aConfiguration, msThemeName);
343}
344
345
346
347

--- 93 unchanged lines hidden (view full) ---

441{
442 if (mpTheme.get() == NULL)
443 return ::boost::shared_ptr<PresenterConfigurationAccess>();
444
445 // Open configuration for writing.
446 ::boost::shared_ptr<PresenterConfigurationAccess> pConfiguration (
447 new PresenterConfigurationAccess(
448 mxContext,
445 OUString::createFromAscii("/org.openoffice.Office.PresenterScreen/"),
449 OUString::createFromAscii("/org.openoffice.Office.extension.PresenterScreen/"),
446 PresenterConfigurationAccess::READ_WRITE));
447
448 // Get configuration node for the view style container of the current
449 // theme.
450 if (pConfiguration->GoToChild(
451 A2S("Presenter/Themes/") + mpTheme->msConfigurationNodeName + A2S("/ViewStyles")))
452 {
453 pConfiguration->GoToChild(

--- 286 unchanged lines hidden (view full) ---

740 OUString sParentThemeName;
741 if ((PresenterConfigurationAccess::GetConfigurationNode(mxThemeRoot, A2S("ParentTheme"))
742 >>= sParentThemeName)
743 && sParentThemeName.getLength()>0)
744 {
745 mpParentTheme = rReadContext.ReadTheme(rConfiguration, sParentThemeName);
746 }
747
450 PresenterConfigurationAccess::READ_WRITE));
451
452 // Get configuration node for the view style container of the current
453 // theme.
454 if (pConfiguration->GoToChild(
455 A2S("Presenter/Themes/") + mpTheme->msConfigurationNodeName + A2S("/ViewStyles")))
456 {
457 pConfiguration->GoToChild(

--- 286 unchanged lines hidden (view full) ---

744 OUString sParentThemeName;
745 if ((PresenterConfigurationAccess::GetConfigurationNode(mxThemeRoot, A2S("ParentTheme"))
746 >>= sParentThemeName)
747 && sParentThemeName.getLength()>0)
748 {
749 mpParentTheme = rReadContext.ReadTheme(rConfiguration, sParentThemeName);
750 }
751
752 // Read the extension that contains the bitmaps referenced in this
753 // theme.
754 OUString sBitmapSourceExtension;
755 if ((PresenterConfigurationAccess::GetConfigurationNode(
756 mxThemeRoot, A2S("BitmapSourceExtension")) >>= sBitmapSourceExtension)
757 && sBitmapSourceExtension.getLength()>0)
758 {
759 rReadContext.SetBitmapSourceExtension(sBitmapSourceExtension);
760 }
761 else
762 {
763 rReadContext.SetBitmapSourceExtension(PresenterComponent::gsExtensionIdentifier);
764 }
765
748 // Background.
749 mpBackground = PresenterBitmapContainer::LoadBitmap(
750 mxThemeRoot,
751 A2S("Background"),
752 rReadContext.mxPresenterHelper,
766 // Background.
767 mpBackground = PresenterBitmapContainer::LoadBitmap(
768 mxThemeRoot,
769 A2S("Background"),
770 rReadContext.mxPresenterHelper,
771 rReadContext.msBasePath,
753 rReadContext.mxCanvas,
754 SharedBitmapDescriptor());
755
756 // Style associations.
757 maStyleAssociations.Read(rReadContext, mxThemeRoot);
758
759 // Pane styles.
760 maPaneStyles.Read(rReadContext, mxThemeRoot);

--- 6 unchanged lines hidden (view full) ---

767 new PresenterBitmapContainer(
768 Reference<container::XNameAccess>(
769 PresenterConfigurationAccess::GetConfigurationNode(mxThemeRoot, A2S("Bitmaps")),
770 UNO_QUERY),
771 mpParentTheme.get()!=NULL
772 ? mpParentTheme->mpIconContainer
773 : ::boost::shared_ptr<PresenterBitmapContainer>(),
774 rReadContext.mxComponentContext,
772 rReadContext.mxCanvas,
773 SharedBitmapDescriptor());
774
775 // Style associations.
776 maStyleAssociations.Read(rReadContext, mxThemeRoot);
777
778 // Pane styles.
779 maPaneStyles.Read(rReadContext, mxThemeRoot);

--- 6 unchanged lines hidden (view full) ---

786 new PresenterBitmapContainer(
787 Reference<container::XNameAccess>(
788 PresenterConfigurationAccess::GetConfigurationNode(mxThemeRoot, A2S("Bitmaps")),
789 UNO_QUERY),
790 mpParentTheme.get()!=NULL
791 ? mpParentTheme->mpIconContainer
792 : ::boost::shared_ptr<PresenterBitmapContainer>(),
793 rReadContext.mxComponentContext,
775 rReadContext.mxCanvas));
794 rReadContext.mxCanvas,
795 rReadContext.msBasePath));
776
777 // Read fonts.
778 Reference<container::XNameAccess> xFontNode(
779 PresenterConfigurationAccess::GetConfigurationNode(mxThemeRoot, A2S("Fonts")),
780 UNO_QUERY);
781 PresenterConfigurationAccess::ForAll(
782 xFontNode,
783 ::boost::bind(&PresenterTheme::Theme::ProcessFont,

--- 47 unchanged lines hidden (view full) ---

831
832//===== ReadContext ===========================================================
833
834ReadContext::ReadContext (
835 const css::uno::Reference<css::uno::XComponentContext>& rxContext,
836 const Reference<rendering::XCanvas>& rxCanvas)
837 : mxComponentContext(rxContext),
838 mxCanvas(rxCanvas),
796
797 // Read fonts.
798 Reference<container::XNameAccess> xFontNode(
799 PresenterConfigurationAccess::GetConfigurationNode(mxThemeRoot, A2S("Fonts")),
800 UNO_QUERY);
801 PresenterConfigurationAccess::ForAll(
802 xFontNode,
803 ::boost::bind(&PresenterTheme::Theme::ProcessFont,

--- 47 unchanged lines hidden (view full) ---

851
852//===== ReadContext ===========================================================
853
854ReadContext::ReadContext (
855 const css::uno::Reference<css::uno::XComponentContext>& rxContext,
856 const Reference<rendering::XCanvas>& rxCanvas)
857 : mxComponentContext(rxContext),
858 mxCanvas(rxCanvas),
839 mxPresenterHelper()
859 mxPresenterHelper(),
860 msBasePath()
840{
841 Reference<lang::XMultiComponentFactory> xFactory (rxContext->getServiceManager());
842 if (xFactory.is())
843 {
844 mxPresenterHelper = Reference<drawing::XPresenterHelper>(
845 xFactory->createInstanceWithContext(
846 OUString::createFromAscii("com.sun.star.comp.Draw.PresenterHelper"),
847 rxContext),
848 UNO_QUERY_THROW);
849 }
861{
862 Reference<lang::XMultiComponentFactory> xFactory (rxContext->getServiceManager());
863 if (xFactory.is())
864 {
865 mxPresenterHelper = Reference<drawing::XPresenterHelper>(
866 xFactory->createInstanceWithContext(
867 OUString::createFromAscii("com.sun.star.comp.Draw.PresenterHelper"),
868 rxContext),
869 UNO_QUERY_THROW);
870 }
871
872 // Get base path to bitmaps.
873 SetBitmapSourceExtension(PresenterComponent::gsExtensionIdentifier);
850}
851
852
853
854
855ReadContext::~ReadContext (void)
856{
857}

--- 134 unchanged lines hidden (view full) ---

992 GetByName(rxNode, A2S("Right")) >>= aBorderSize.mnRight;
993 GetByName(rxNode, A2S("Bottom")) >>= aBorderSize.mnBottom;
994 }
995
996 return aBorderSize;
997}
998
999
874}
875
876
877
878
879ReadContext::~ReadContext (void)
880{
881}

--- 134 unchanged lines hidden (view full) ---

1016 GetByName(rxNode, A2S("Right")) >>= aBorderSize.mnRight;
1017 GetByName(rxNode, A2S("Bottom")) >>= aBorderSize.mnBottom;
1018 }
1019
1020 return aBorderSize;
1021}
1022
1023
1024
1025
1026void ReadContext::SetBitmapSourceExtension (const OUString& rsExtensionIdentifier)
1027{
1028 // Get base path to bitmaps.
1029 msBasePath = PresenterComponent::GetBasePath(mxComponentContext, rsExtensionIdentifier);
1030}
1031
1032
1033
1034
1000//===== PaneStyleContainer ====================================================
1001
1002void PaneStyleContainer::Read (
1003 ReadContext& rReadContext,
1004 const Reference<container::XHierarchicalNameAccess>& rxThemeRoot)
1005{
1006 Reference<container::XNameAccess> xPaneStyleList (
1007 PresenterConfigurationAccess::GetConfigurationNode(

--- 68 unchanged lines hidden (view full) ---

1076 Reference<container::XNameAccess> xBitmapsNode (rValues[5], UNO_QUERY);
1077 pStyle->mpBitmaps.reset(new PresenterBitmapContainer(
1078 xBitmapsNode,
1079 pStyle->mpParentStyle.get()!=NULL
1080 ? pStyle->mpParentStyle->mpBitmaps
1081 : ::boost::shared_ptr<PresenterBitmapContainer>(),
1082 rReadContext.mxComponentContext,
1083 rReadContext.mxCanvas,
1035//===== PaneStyleContainer ====================================================
1036
1037void PaneStyleContainer::Read (
1038 ReadContext& rReadContext,
1039 const Reference<container::XHierarchicalNameAccess>& rxThemeRoot)
1040{
1041 Reference<container::XNameAccess> xPaneStyleList (
1042 PresenterConfigurationAccess::GetConfigurationNode(

--- 68 unchanged lines hidden (view full) ---

1111 Reference<container::XNameAccess> xBitmapsNode (rValues[5], UNO_QUERY);
1112 pStyle->mpBitmaps.reset(new PresenterBitmapContainer(
1113 xBitmapsNode,
1114 pStyle->mpParentStyle.get()!=NULL
1115 ? pStyle->mpParentStyle->mpBitmaps
1116 : ::boost::shared_ptr<PresenterBitmapContainer>(),
1117 rReadContext.mxComponentContext,
1118 rReadContext.mxCanvas,
1119 rReadContext.msBasePath,
1084 rReadContext.mxPresenterHelper));
1085 }
1086
1087 push_back(pStyle);
1088}
1089
1090
1091

--- 142 unchanged lines hidden (view full) ---

1234
1235 Reference<container::XHierarchicalNameAccess> xBackgroundNode (
1236 PresenterConfigurationAccess::GetProperty(rxProperties, A2S("Background")),
1237 UNO_QUERY);
1238 SharedBitmapDescriptor pBackground (PresenterBitmapContainer::LoadBitmap(
1239 xBackgroundNode,
1240 OUString(),
1241 rReadContext.mxPresenterHelper,
1120 rReadContext.mxPresenterHelper));
1121 }
1122
1123 push_back(pStyle);
1124}
1125
1126
1127

--- 142 unchanged lines hidden (view full) ---

1270
1271 Reference<container::XHierarchicalNameAccess> xBackgroundNode (
1272 PresenterConfigurationAccess::GetProperty(rxProperties, A2S("Background")),
1273 UNO_QUERY);
1274 SharedBitmapDescriptor pBackground (PresenterBitmapContainer::LoadBitmap(
1275 xBackgroundNode,
1276 OUString(),
1277 rReadContext.mxPresenterHelper,
1278 rReadContext.msBasePath,
1242 rReadContext.mxCanvas,
1243 SharedBitmapDescriptor()));
1244 if (pBackground.get() != NULL && pBackground->GetNormalBitmap().is())
1245 pStyle->mpBackground = pBackground;
1246
1247 push_back(pStyle);
1248}
1249

--- 124 unchanged lines hidden ---
1279 rReadContext.mxCanvas,
1280 SharedBitmapDescriptor()));
1281 if (pBackground.get() != NULL && pBackground->GetNormalBitmap().is())
1282 pStyle->mpBackground = pBackground;
1283
1284 push_back(pStyle);
1285}
1286

--- 124 unchanged lines hidden ---