summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2013-09-19 14:55:24 +0100
committerCaolán McNamara <caolanm@redhat.com>2013-09-20 16:35:29 +0100
commitd023339c2f85555212bdb9804854dcc2c403b50e (patch)
tree2c4f10df45f2ce8d4200fcda72fc87e1eb1b8219
parente9ba193f5e61d7855be694a2c414b9e1bc198d5e (diff)
Turn sidebar back to non-experimental
This reverts commit 7ce2a89f4f8fa84232896766276cb3433ada239c. Change-Id: I53f572777e84f66fd4c3d18fb686dac09095804a revert d38cb53e3bcf3fd95a75e03b01c3b7a209d07b46 Change-Id: I5b243b69e50084316aaeab250d6b01079c12b718 Revert "sidebar: disable impress task pane if sidebar is enabled." This reverts commit ee1726bfdba483623d496a3bcc09089e8b55cd65. revert 54d820a7815af03a248c1aa424fae9bf9a4881f4 Change-Id: Ie7c83d88f5427a7e42fa50879280a0c4a7c2cdd1 Revert "Only register and use the Sidebar if it is globally enabled." This reverts commit 66a5cc468cef0c6db8b42b7f25367f04208e6f2e. Conflicts: sfx2/source/view/viewfrm.cxx Change-Id: I17fe702996c4adf7f387573d36ea993f8cc32c96 Revert "disable sidebar menu option if it is disabled." This reverts commit 05f0eb57618d090fa45011120a907a3b1157accb. Revert "finally get the taskpane rendering again" This reverts commit 228bb7ffe0d404ba1225f7b4d26ca71e098577d9. Conflicts: officecfg/registry/data/org/openoffice/Office/Impress.xcu sd/source/ui/framework/factories/TaskPanelFactory.cxx sd/source/ui/framework/tools/FrameworkHelper.cxx Change-Id: I248cc9a769695cde19e78774d42ce666dc685599 Revert "don't throw up the sidebar on start." This reverts commit 645db9a2bd9b1eec381de60c491e6b7f9ee7a7b4. Conflicts: officecfg/registry/data/org/openoffice/Office/Views.xcu Change-Id: I911859757e2e019836e8ed5213d2ba69ff82aec8 Revert "update to the right service name for new URLs." This reverts commit 55f49970f4085e3a1498961edabd5303bd6bea6c. Conflicts: sd/source/ui/framework/tools/FrameworkHelper.cxx Change-Id: I1ba2762a4c969a9125ff8354a9b6035813290021 Revert "tentatively restore more UNO / task-pane goo ..." This reverts commit 052ac10a6f9b28b9b06884dd3ed41879722be6c9. Conflicts: officecfg/registry/data/org/openoffice/Office/Impress.xcu Change-Id: I7e62f27329af033df811549436718648a6447dea Revert "more reverts, first cut at making sidebar optional." This reverts commit a65a423e22fc03d0b7850bbf20dfc30f6cfa34dd. Revert "add experimental option for sidebar to 'Advanced' pane." This reverts commit 54d820a7815af03a248c1aa424fae9bf9a4881f4. Conflicts: cui/source/options/optjava.cxx sd/source/ui/framework/module/ImpressModule.cxx Change-Id: I09a6c0f7834c8ef330d05a014505aaaf09ae096f Revert "Restore FrameworkHelper taskpane URLs." This reverts commit e9c2d5b26b1e1b52bdf87192a76314b7362fa80c. more foo Change-Id: I2eaa2fbd74dc7a2f7ba937d310472cee6b5a0b57 really go to town on it Change-Id: I885dc03cd0286bbfdf05c05da9f0bbea2b78bcf4
-rw-r--r--cui/source/options/optjava.cxx15
-rw-r--r--cui/source/options/optjava.hxx1
-rw-r--r--cui/uiconfig/ui/optadvancedpage.ui19
-rw-r--r--include/sfx2/sidebar/SidebarChildWindow.hxx2
-rw-r--r--include/sfx2/viewfrm.hxx3
-rw-r--r--include/svtools/miscopt.hxx3
-rw-r--r--include/svtools/restartdialog.hxx5
-rw-r--r--officecfg/registry/data/org/openoffice/Office/Impress.xcu22
-rw-r--r--officecfg/registry/data/org/openoffice/Office/UI/Factories.xcu14
-rw-r--r--officecfg/registry/data/org/openoffice/Office/UI/ImpressWindowState.xcu55
-rw-r--r--officecfg/registry/data/org/openoffice/Office/Views.xcu3
-rw-r--r--officecfg/registry/schema/org/openoffice/Office/Common.xcs8
-rw-r--r--sc/source/ui/app/scdll.cxx2
-rw-r--r--sd/Library_sd.mk36
-rw-r--r--sd/sdi/ToolPanelViewShell.sdi122
-rw-r--r--sd/sdi/sdslots.sdi1
-rw-r--r--sd/source/ui/accessibility/AccessibleScrollPanel.cxx142
-rw-r--r--sd/source/ui/accessibility/AccessibleTreeNode.cxx702
-rw-r--r--sd/source/ui/app/sddll1.cxx6
-rw-r--r--sd/source/ui/app/sddll2.cxx3
-rw-r--r--sd/source/ui/dlg/PaneChildWindows.cxx89
-rw-r--r--sd/source/ui/dlg/PaneShells.cxx23
-rw-r--r--sd/source/ui/framework/factories/BasicPaneFactory.cxx14
-rw-r--r--sd/source/ui/framework/factories/BasicPaneFactory.hxx1
-rw-r--r--sd/source/ui/framework/factories/BasicViewFactory.cxx13
-rw-r--r--sd/source/ui/framework/factories/TaskPanelFactory.cxx312
-rw-r--r--sd/source/ui/framework/factories/TaskPanelFactory.hxx88
-rw-r--r--sd/source/ui/framework/module/ImpressModule.cxx9
-rw-r--r--sd/source/ui/framework/module/ToolPanelModule.cxx5
-rw-r--r--sd/source/ui/framework/module/ToolPanelModule.hxx2
-rw-r--r--sd/source/ui/framework/tools/FrameworkHelper.cxx31
-rw-r--r--sd/source/ui/inc/AccessibleScrollPanel.hxx74
-rw-r--r--sd/source/ui/inc/AccessibleTreeNode.hxx292
-rw-r--r--sd/source/ui/inc/PaneChildWindows.hxx23
-rw-r--r--sd/source/ui/inc/ViewShell.hxx1
-rw-r--r--sd/source/ui/inc/framework/FrameworkHelper.hxx3
-rw-r--r--sd/source/ui/sidebar/PanelFactory.cxx14
-rw-r--r--sd/source/ui/toolpanel/ControlContainer.cxx437
-rw-r--r--sd/source/ui/toolpanel/ControlContainerDescriptor.hxx131
-rw-r--r--sd/source/ui/toolpanel/LayoutMenu.cxx1002
-rw-r--r--sd/source/ui/toolpanel/LayoutMenu.hxx230
-rw-r--r--sd/source/ui/toolpanel/MethodGuard.hxx62
-rw-r--r--sd/source/ui/toolpanel/ScrollPanel.cxx806
-rw-r--r--sd/source/ui/toolpanel/SlideSorterCacheDisplay.cxx363
-rw-r--r--sd/source/ui/toolpanel/SubToolPanel.cxx381
-rw-r--r--sd/source/ui/toolpanel/TaskPaneControlFactory.cxx49
-rw-r--r--sd/source/ui/toolpanel/TaskPaneFocusManager.cxx316
-rw-r--r--sd/source/ui/toolpanel/TaskPaneFocusManager.hxx130
-rw-r--r--sd/source/ui/toolpanel/TaskPaneShellManager.cxx175
-rw-r--r--sd/source/ui/toolpanel/TaskPaneShellManager.hxx116
-rw-r--r--sd/source/ui/toolpanel/TaskPaneTreeNode.cxx284
-rw-r--r--sd/source/ui/toolpanel/TitleBar.cxx559
-rw-r--r--sd/source/ui/toolpanel/TitledControl.cxx419
-rw-r--r--sd/source/ui/toolpanel/ToolPanel.cxx105
-rw-r--r--sd/source/ui/toolpanel/ToolPanel.hxx73
-rw-r--r--sd/source/ui/toolpanel/ToolPanelFactory.cxx246
-rw-r--r--sd/source/ui/toolpanel/ToolPanelUIElement.cxx125
-rw-r--r--sd/source/ui/toolpanel/ToolPanelUIElement.hxx78
-rw-r--r--sd/source/ui/toolpanel/ToolPanelViewShell.cxx895
-rw-r--r--sd/source/ui/toolpanel/controls/AllMasterPagesSelector.cxx199
-rw-r--r--sd/source/ui/toolpanel/controls/AllMasterPagesSelector.hxx87
-rw-r--r--sd/source/ui/toolpanel/controls/CurrentMasterPagesSelector.cxx334
-rw-r--r--sd/source/ui/toolpanel/controls/CurrentMasterPagesSelector.hxx77
-rw-r--r--sd/source/ui/toolpanel/controls/CustomAnimationPanel.cxx106
-rw-r--r--sd/source/ui/toolpanel/controls/CustomAnimationPanel.hxx71
-rw-r--r--sd/source/ui/toolpanel/controls/DocumentHelper.cxx575
-rw-r--r--sd/source/ui/toolpanel/controls/DocumentHelper.hxx110
-rw-r--r--sd/source/ui/toolpanel/controls/MasterPageContainer.cxx1208
-rw-r--r--sd/source/ui/toolpanel/controls/MasterPageContainer.hxx208
-rw-r--r--sd/source/ui/toolpanel/controls/MasterPageContainerFiller.cxx191
-rw-r--r--sd/source/ui/toolpanel/controls/MasterPageContainerFiller.hxx92
-rw-r--r--sd/source/ui/toolpanel/controls/MasterPageContainerProviders.cxx312
-rw-r--r--sd/source/ui/toolpanel/controls/MasterPageContainerProviders.hxx192
-rw-r--r--sd/source/ui/toolpanel/controls/MasterPageContainerQueue.cxx300
-rw-r--r--sd/source/ui/toolpanel/controls/MasterPageContainerQueue.hxx134
-rw-r--r--sd/source/ui/toolpanel/controls/MasterPageDescriptor.cxx416
-rw-r--r--sd/source/ui/toolpanel/controls/MasterPageDescriptor.hxx235
-rw-r--r--sd/source/ui/toolpanel/controls/MasterPageObserver.cxx415
-rw-r--r--sd/source/ui/toolpanel/controls/MasterPagesPanel.cxx148
-rw-r--r--sd/source/ui/toolpanel/controls/MasterPagesPanel.hxx66
-rw-r--r--sd/source/ui/toolpanel/controls/MasterPagesSelector.cxx842
-rw-r--r--sd/source/ui/toolpanel/controls/MasterPagesSelector.hxx226
-rw-r--r--sd/source/ui/toolpanel/controls/PreviewValueSet.cxx232
-rw-r--r--sd/source/ui/toolpanel/controls/PreviewValueSet.hxx90
-rw-r--r--sd/source/ui/toolpanel/controls/RecentMasterPagesSelector.cxx149
-rw-r--r--sd/source/ui/toolpanel/controls/RecentMasterPagesSelector.hxx70
-rw-r--r--sd/source/ui/toolpanel/controls/RecentlyUsedMasterPages.cxx482
-rw-r--r--sd/source/ui/toolpanel/controls/RecentlyUsedMasterPages.hxx119
-rw-r--r--sd/source/ui/toolpanel/controls/SlideTransitionPanel.cxx109
-rw-r--r--sd/source/ui/toolpanel/controls/SlideTransitionPanel.hxx71
-rw-r--r--sd/source/ui/toolpanel/controls/TableDesignPanel.cxx102
-rw-r--r--sd/source/ui/toolpanel/controls/TableDesignPanel.hxx71
-rw-r--r--sd/source/ui/unoidl/facreg.cxx38
-rw-r--r--sd/source/ui/view/ToolBarManager.cxx1
-rw-r--r--sd/source/ui/view/ViewShellBase.cxx13
-rw-r--r--sd/source/ui/view/ViewShellImplementation.cxx2
-rw-r--r--sd/util/sd.component6
-rw-r--r--sfx2/source/sidebar/SidebarChildWindow.cxx8
-rw-r--r--sfx2/source/view/viewfrm.cxx58
-rw-r--r--svtools/source/config/miscopt.cxx36
-rw-r--r--svtools/source/dialogs/restartdialog.cxx3
-rw-r--r--svtools/uiconfig/ui/restartdialog.ui16
-rw-r--r--sw/source/ui/app/swmodule.cxx2
103 files changed, 36 insertions, 17326 deletions
diff --git a/cui/source/options/optjava.cxx b/cui/source/options/optjava.cxx
index 00b27442dc08..0396de23ae7e 100644
--- a/cui/source/options/optjava.cxx
+++ b/cui/source/options/optjava.cxx
@@ -148,7 +148,6 @@ SvxJavaOptionsPage::SvxJavaOptionsPage( Window* pParent, const SfxItemSet& rSet
get(m_pParameterBtn, "parameters");
get(m_pClassPathBtn, "classpath");
get(m_pExperimentalCB, "experimental");
- get(m_pExpSidebarCB, "exp_sidebar");
get(m_pMacroCB, "macrorecording");
m_sAccessibilityText = get<FixedText>("a11y")->GetText();
m_sAddDialogText = get<FixedText>("selectruntime")->GetText();
@@ -630,18 +629,6 @@ sal_Bool SvxJavaOptionsPage::FillItemSet( SfxItemSet& /*rCoreSet*/ )
bModified = sal_True;
}
- if ( m_pExpSidebarCB->IsChecked() != m_pExpSidebarCB->GetSavedValue() )
- {
- SvtMiscOptions aMiscOpt;
- aMiscOpt.SetExperimentalSidebar( m_pExpSidebarCB->IsChecked() );
-
- svtools::executeRestartDialog(
- comphelper::getProcessComponentContext(), this,
- svtools::RESTART_REASON_MODIFIED_SIDEBAR);
-
- bModified = sal_True;
- }
-
if ( m_pMacroCB->IsChecked() != m_pMacroCB->GetSavedValue() )
{
SvtMiscOptions aMiscOpt;
@@ -759,8 +746,6 @@ void SvxJavaOptionsPage::Reset( const SfxItemSet& /*rSet*/ )
m_pExperimentalCB->Check( aMiscOpt.IsExperimentalMode() );
m_pExperimentalCB->SaveValue();
- m_pExpSidebarCB->Check( aMiscOpt.IsExperimentalSidebar() );
- m_pExpSidebarCB->SaveValue();
m_pMacroCB->Check( aMiscOpt.IsMacroRecorderMode() );
m_pMacroCB->SaveValue();
diff --git a/cui/source/options/optjava.hxx b/cui/source/options/optjava.hxx
index 5892455382aa..a2724d7a2e9d 100644
--- a/cui/source/options/optjava.hxx
+++ b/cui/source/options/optjava.hxx
@@ -74,7 +74,6 @@ private:
Timer m_aResetTimer;
CheckBox* m_pExperimentalCB;
- CheckBox* m_pExpSidebarCB;
CheckBox* m_pMacroCB;
::std::vector< JavaInfo* >
diff --git a/cui/uiconfig/ui/optadvancedpage.ui b/cui/uiconfig/ui/optadvancedpage.ui
index 3be64d132f58..26ba413a251c 100644
--- a/cui/uiconfig/ui/optadvancedpage.ui
+++ b/cui/uiconfig/ui/optadvancedpage.ui
@@ -340,23 +340,6 @@
</packing>
</child>
<child>
- <object class="GtkCheckButton" id="exp_sidebar">
- <property name="label" translatable="yes">Enable experimental sidebar (on restart)</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="use_underline">True</property>
- <property name="xalign">0</property>
- <property name="draw_indicator">True</property>
- </object>
- <packing>
- <property name="left_attach">0</property>
- <property name="top_attach">1</property>
- <property name="width">1</property>
- <property name="height">1</property>
- </packing>
- </child>
- <child>
<object class="GtkCheckButton" id="macrorecording">
<property name="label" translatable="yes">Enable macro recording (limited)</property>
<property name="visible">True</property>
@@ -367,7 +350,7 @@
</object>
<packing>
<property name="left_attach">0</property>
- <property name="top_attach">2</property>
+ <property name="top_attach">1</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
diff --git a/include/sfx2/sidebar/SidebarChildWindow.hxx b/include/sfx2/sidebar/SidebarChildWindow.hxx
index 6f7890c8f854..c78c17f64129 100644
--- a/include/sfx2/sidebar/SidebarChildWindow.hxx
+++ b/include/sfx2/sidebar/SidebarChildWindow.hxx
@@ -40,8 +40,6 @@ public:
SfxBindings* pBindings,
SfxChildWinInfo* pInfo);
- static void RegisterChildWindowIfEnabled (sal_Bool bVisible=sal_False, SfxModule *pMod=NULL, sal_uInt16 nFlags=0);
-
SFX_DECL_CHILDWINDOW_WITHID(SidebarChildWindow);
static sal_Int32 GetDefaultWidth (Window* pWindow);
diff --git a/include/sfx2/viewfrm.hxx b/include/sfx2/viewfrm.hxx
index 7840b2940dee..dce9b89c7e95 100644
--- a/include/sfx2/viewfrm.hxx
+++ b/include/sfx2/viewfrm.hxx
@@ -152,9 +152,6 @@ public:
static void ActivateToolPanel( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& i_rFrame, const OUString& i_rPanelURL );
- /// is the new sidebar enabled for the app as a whole ?
- static bool IsSidebarEnabled();
-
// interne Handler
SAL_DLLPRIVATE virtual sal_Bool SetBorderPixelImpl( const SfxViewShell *pSh, const SvBorder &rBorder );
SAL_DLLPRIVATE virtual const SvBorder& GetBorderPixelImpl( const SfxViewShell *pSh ) const;
diff --git a/include/svtools/miscopt.hxx b/include/svtools/miscopt.hxx
index ca0b569b12ad..85c5b604e689 100644
--- a/include/svtools/miscopt.hxx
+++ b/include/svtools/miscopt.hxx
@@ -109,9 +109,6 @@ class SVT_DLLPUBLIC SvtMiscOptions: public utl::detail::Options
void SetExperimentalMode( sal_Bool bSet );
sal_Bool IsExperimentalMode() const;
- void SetExperimentalSidebar( sal_Bool bSet );
- sal_Bool IsExperimentalSidebar() const;
-
void SetMacroRecorderMode( sal_Bool bSet );
sal_Bool IsMacroRecorderMode() const;
diff --git a/include/svtools/restartdialog.hxx b/include/svtools/restartdialog.hxx
index d74d6d3e863f..993b0998aa0b 100644
--- a/include/svtools/restartdialog.hxx
+++ b/include/svtools/restartdialog.hxx
@@ -29,12 +29,9 @@ enum RestartReason {
RESTART_REASON_PDF_AS_STANDARD_JOB_FORMAT,
// For the modified default print job format to take effect,
// %PRODUCTNAME must be restarted.
- RESTART_REASON_BIBLIOGRAPHY_INSTALL,
+ RESTART_REASON_BIBLIOGRAPHY_INSTALL
// "For the bibliography to work properly,
// %PRODUCTNAME must be restarted."
- RESTART_REASON_MODIFIED_SIDEBAR
- // "For the sidebar to work properly,
- // %PRODUCTNAME must be restarted."
};
// Must be called with the solar mutex locked:
diff --git a/officecfg/registry/data/org/openoffice/Office/Impress.xcu b/officecfg/registry/data/org/openoffice/Office/Impress.xcu
index 3f2e9a43debb..accf3471a3f1 100644
--- a/officecfg/registry/data/org/openoffice/Office/Impress.xcu
+++ b/officecfg/registry/data/org/openoffice/Office/Impress.xcu
@@ -82,11 +82,6 @@
<value>private:resource/pane/LeftDrawPane</value>
</prop>
</node>
- <node oor:name="R3" oor:op="replace">
- <prop oor:name="URL">
- <value>private:resource/pane/RightPane</value>
- </prop>
- </node>
</node>
</node>
<node oor:name="F1" oor:op="replace">
@@ -126,11 +121,6 @@
</node>
<node oor:name="R6" oor:op="replace">
<prop oor:name="URL">
- <value>private:resource/view/TaskPane</value>
- </prop>
- </node>
- <node oor:name="R7" oor:op="replace">
- <prop oor:name="URL">
<value>private:resource/view/PresentationView</value>
</prop>
</node>
@@ -150,7 +140,7 @@
</node>
<node oor:name="F3" oor:op="replace">
<prop oor:name="ServiceName">
- <value>com.sun.star.drawing.framework.TaskPanelFactory</value>
+ <value>com.sun.star.comp.Draw.framework.TaskPanelFactory</value>
</prop>
<node oor:name="ResourceList">
<node oor:name="R0a" oor:op="replace">
@@ -165,27 +155,27 @@
</node>
<node oor:name="R0c" oor:op="replace">
<prop oor:name="URL">
- <value>private:resource/toolpanel/DrawingFramework/MasterPages</value>
+ <value>private:resource/toolpanel/UsedMasterPages</value>
</prop>
</node>
<node oor:name="R1" oor:op="replace">
<prop oor:name="URL">
- <value>private:resource/toolpanel/DrawingFramework/Layouts</value>
+ <value>private:resource/toolpanel/Layouts</value>
</prop>
</node>
<node oor:name="R2" oor:op="replace">
<prop oor:name="URL">
- <value>private:resource/toolpanel/DrawingFramework/TableDesign</value>
+ <value>private:resource/toolpanel/TableDesign</value>
</prop>
</node>
<node oor:name="R3" oor:op="replace">
<prop oor:name="URL">
- <value>private:resource/toolpanel/DrawingFramework/CustomAnimations</value>
+ <value>private:resource/toolpanel/CustomAnimations</value>
</prop>
</node>
<node oor:name="R4" oor:op="replace">
<prop oor:name="URL">
- <value>private:resource/toolpanel/DrawingFramework/SlideTransitions</value>
+ <value>private:resource/toolpanel/SlideTransitions</value>
</prop>
</node>
</node>
diff --git a/officecfg/registry/data/org/openoffice/Office/UI/Factories.xcu b/officecfg/registry/data/org/openoffice/Office/UI/Factories.xcu
index 61b2f8d12f85..15c0a04bc072 100644
--- a/officecfg/registry/data/org/openoffice/Office/UI/Factories.xcu
+++ b/officecfg/registry/data/org/openoffice/Office/UI/Factories.xcu
@@ -76,20 +76,6 @@
<value>com.sun.star.comp.framework.StatusBarFactory</value>
</prop>
</node>
- <node oor:name="org.openoffice.Office.Impress.ImpressToolPanelFactory" oor:op="replace">
- <prop oor:name="Type">
- <value>toolpanel</value>
- </prop>
- <prop oor:name="Name">
- <value>DrawingFramework</value>
- </prop>
- <prop oor:name="Module">
- <value>com.sun.star.presentation.PresentationDocument</value>
- </prop>
- <prop oor:name="FactoryImplementation">
- <value>com.sun.star.drawing.DefaultToolPanelFactory</value>
- </prop>
- </node>
<node oor:name="SvxPanelFactory" oor:op="replace">
<prop oor:name="Type">
<value>toolpanel</value>
diff --git a/officecfg/registry/data/org/openoffice/Office/UI/ImpressWindowState.xcu b/officecfg/registry/data/org/openoffice/Office/UI/ImpressWindowState.xcu
index 5aa630a4d618..c72079b3bc0a 100644
--- a/officecfg/registry/data/org/openoffice/Office/UI/ImpressWindowState.xcu
+++ b/officecfg/registry/data/org/openoffice/Office/UI/ImpressWindowState.xcu
@@ -825,61 +825,6 @@
<value>true</value>
</prop>
</node>
- <node oor:name="private:resource/toolpanel/DrawingFramework/MasterPages" oor:op="replace">
- <prop oor:name="Visible" oor:type="xs:boolean">
- <value>false</value>
- </prop>
- <prop oor:name="UIName" oor:type="xs:string">
- <value xml:lang="en-US">Master Pages</value>
- </prop>
- <prop oor:name="ImageURL" oor:type="xs:string">
- <value>private:commandimage/PresentationLayout</value>
- </prop>
- </node>
- <node oor:name="private:resource/toolpanel/DrawingFramework/Layouts" oor:op="replace">
- <prop oor:name="Visible" oor:type="xs:boolean">
- <value>false</value>
- </prop>
- <prop oor:name="UIName" oor:type="xs:string">
- <value xml:lang="en-US">Layouts</value>
- </prop>
- <prop oor:name="ImageURL" oor:type="xs:string">
- <value>private:commandimage/ModifyPage</value>
- </prop>
- </node>
- <node oor:name="private:resource/toolpanel/DrawingFramework/TableDesign" oor:op="replace">
- <prop oor:name="Visible" oor:type="xs:boolean">
- <value>false</value>
- </prop>
- <prop oor:name="UIName" oor:type="xs:string">
- <value xml:lang="en-US">Table Design</value>
- </prop>
- <prop oor:name="ImageURL" oor:type="xs:string">
- <value>private:commandimage/InsertTable</value>
- </prop>
- </node>
- <node oor:name="private:resource/toolpanel/DrawingFramework/CustomAnimations" oor:op="replace">
- <prop oor:name="Visible" oor:type="xs:boolean">
- <value>false</value>
- </prop>
- <prop oor:name="UIName" oor:type="xs:string">
- <value xml:lang="en-US">Custom Animation</value>
- </prop>
- <prop oor:name="ImageURL" oor:type="xs:string">
- <value>private:commandimage/CustomAnimation</value>
- </prop>
- </node>
- <node oor:name="private:resource/toolpanel/DrawingFramework/SlideTransitions" oor:op="replace">
- <prop oor:name="Visible" oor:type="xs:boolean">
- <value>false</value>
- </prop>
- <prop oor:name="UIName" oor:type="xs:string">
- <value xml:lang="en-US">Slide Transition</value>
- </prop>
- <prop oor:name="ImageURL" oor:type="xs:string">
- <value>private:commandimage/RehearseTimings</value>
- </prop>
- </node>
<node oor:name="private:resource/toolbar/optimizetablebar" oor:op="replace">
<prop oor:name="Docked" oor:type="xs:boolean">
<value>false</value>
diff --git a/officecfg/registry/data/org/openoffice/Office/Views.xcu b/officecfg/registry/data/org/openoffice/Office/Views.xcu
index 65d02dd6f2b4..81f56d26c983 100644
--- a/officecfg/registry/data/org/openoffice/Office/Views.xcu
+++ b/officecfg/registry/data/org/openoffice/Office/Views.xcu
@@ -24,8 +24,7 @@
<value>false</value>
</prop>
</node>
-
- <!-- show Sidebar child window by default (when enabled via the Experimental settings) - oor:name == SID_SIDEBAR -->
+ <!-- show Sidebar child window by default - oor:name == SID_SIDEBAR -->
<node oor:name="10336" oor:op="replace">
<prop oor:name="Visible" oor:type="xs:boolean">
<value>true</value>
diff --git a/officecfg/registry/schema/org/openoffice/Office/Common.xcs b/officecfg/registry/schema/org/openoffice/Office/Common.xcs
index d2f26c0d4cde..8c1e568ab10c 100644
--- a/officecfg/registry/schema/org/openoffice/Office/Common.xcs
+++ b/officecfg/registry/schema/org/openoffice/Office/Common.xcs
@@ -5520,17 +5520,11 @@
</prop>
<prop oor:name="ExperimentalMode" oor:type="xs:boolean" oor:nillable="false">
<info>
- <desc>Determines if various experimental, and potentially unstable
+ <desc>Determins if various experimental, and potentially unstable
features should be enabled in the user interface.</desc>
</info>
<value>false</value>
</prop>
- <prop oor:name="ExperimentalSidebar" oor:type="xs:boolean" oor:nillable="false">
- <info>
- <desc>Determines if the experimental sidebar UI change should be enabled.</desc>
- </info>
- <value>false</value>
- </prop>
<prop oor:name="MacroRecorderMode" oor:type="xs:boolean" oor:nillable="false">
<info>
<desc>Determins if the limited, and awkward code producing
diff --git a/sc/source/ui/app/scdll.cxx b/sc/source/ui/app/scdll.cxx
index c2ae6e59ce5a..f904eebfdd61 100644
--- a/sc/source/ui/app/scdll.cxx
+++ b/sc/source/ui/app/scdll.cxx
@@ -226,7 +226,7 @@ void ScDLL::Init()
// common SFX controller
::sfx2::TaskPaneWrapper::RegisterChildWindow( false, pMod );
- ::sfx2::sidebar::SidebarChildWindow::RegisterChildWindowIfEnabled(false, pMod);
+ ::sfx2::sidebar::SidebarChildWindow::RegisterChildWindow(false, pMod);
// Svx-StatusBar-Controller
SvxInsertStatusBarControl ::RegisterControl(SID_ATTR_INSERT, pMod);
diff --git a/sd/Library_sd.mk b/sd/Library_sd.mk
index 5514e17cbea8..3ec4771aaef1 100644
--- a/sd/Library_sd.mk
+++ b/sd/Library_sd.mk
@@ -172,10 +172,8 @@ $(eval $(call gb_Library_add_exception_objects,sd,\
sd/source/ui/accessibility/AccessiblePresentationGraphicShape \
sd/source/ui/accessibility/AccessiblePresentationOLEShape \
sd/source/ui/accessibility/AccessiblePresentationShape \
- sd/source/ui/accessibility/AccessibleScrollPanel \
sd/source/ui/accessibility/AccessibleSlideSorterObject \
sd/source/ui/accessibility/AccessibleSlideSorterView \
- sd/source/ui/accessibility/AccessibleTreeNode \
sd/source/ui/accessibility/AccessibleViewForwarder \
sd/source/ui/accessibility/SdShapeTypes \
sd/source/ui/animations/CustomAnimationCreateDialog \
@@ -251,7 +249,6 @@ $(eval $(call gb_Library_add_exception_objects,sd,\
sd/source/ui/framework/factories/FullScreenPane \
sd/source/ui/framework/factories/Pane \
sd/source/ui/framework/factories/PresentationFactory \
- sd/source/ui/framework/factories/TaskPanelFactory \
sd/source/ui/framework/factories/ViewShellWrapper \
sd/source/ui/framework/module/CenterViewFocusModule \
sd/source/ui/framework/module/DrawModule \
@@ -340,6 +337,7 @@ $(eval $(call gb_Library_add_exception_objects,sd,\
sd/source/ui/sidebar/MasterPageContainerProviders \
sd/source/ui/sidebar/MasterPageContainerQueue \
sd/source/ui/sidebar/MasterPageDescriptor \
+ sd/source/ui/sidebar/MasterPageObserver \
sd/source/ui/sidebar/MasterPagesSelector \
sd/source/ui/sidebar/NavigatorWrapper \
sd/source/ui/sidebar/PanelBase \
@@ -406,38 +404,6 @@ $(eval $(call gb_Library_add_exception_objects,sd,\
sd/source/ui/table/TableDesignPane \
sd/source/ui/table/tablefunction \
sd/source/ui/table/tableobjectbar \
- sd/source/ui/toolpanel/ControlContainer \
- sd/source/ui/toolpanel/LayoutMenu \
- sd/source/ui/toolpanel/ScrollPanel \
- sd/source/ui/toolpanel/SlideSorterCacheDisplay \
- sd/source/ui/toolpanel/SubToolPanel \
- sd/source/ui/toolpanel/TaskPaneControlFactory \
- sd/source/ui/toolpanel/TaskPaneFocusManager \
- sd/source/ui/toolpanel/TaskPaneShellManager \
- sd/source/ui/toolpanel/TaskPaneTreeNode \
- sd/source/ui/toolpanel/TitleBar \
- sd/source/ui/toolpanel/TitledControl \
- sd/source/ui/toolpanel/ToolPanel \
- sd/source/ui/toolpanel/ToolPanelFactory \
- sd/source/ui/toolpanel/ToolPanelUIElement \
- sd/source/ui/toolpanel/ToolPanelViewShell \
- sd/source/ui/toolpanel/controls/AllMasterPagesSelector \
- sd/source/ui/toolpanel/controls/CurrentMasterPagesSelector \
- sd/source/ui/toolpanel/controls/CustomAnimationPanel \
- sd/source/ui/toolpanel/controls/DocumentHelper \
- sd/source/ui/toolpanel/controls/MasterPageContainer \
- sd/source/ui/toolpanel/controls/MasterPageContainerFiller \
- sd/source/ui/toolpanel/controls/MasterPageContainerProviders \
- sd/source/ui/toolpanel/controls/MasterPageContainerQueue \
- sd/source/ui/toolpanel/controls/MasterPageDescriptor \
- sd/source/ui/toolpanel/controls/MasterPageObserver \
- sd/source/ui/toolpanel/controls/MasterPagesPanel \
- sd/source/ui/toolpanel/controls/MasterPagesSelector \
- sd/source/ui/toolpanel/controls/PreviewValueSet \
- sd/source/ui/toolpanel/controls/RecentMasterPagesSelector \
- sd/source/ui/toolpanel/controls/RecentlyUsedMasterPages \
- sd/source/ui/toolpanel/controls/SlideTransitionPanel \
- sd/source/ui/toolpanel/controls/TableDesignPanel \
sd/source/ui/tools/AsynchronousCall \
sd/source/ui/tools/ConfigurationAccess \
sd/source/ui/tools/EventMultiplexer \
diff --git a/sd/sdi/ToolPanelViewShell.sdi b/sd/sdi/ToolPanelViewShell.sdi
deleted file mode 100644
index 34394a2c09b1..000000000000
--- a/sd/sdi/ToolPanelViewShell.sdi
+++ /dev/null
@@ -1,122 +0,0 @@
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-interface MasterPagesSelectorInterface
-{
- SID_TP_APPLY_TO_ALL_SLIDES
- [
- ExecMethod = Execute ;
- StateMethod = GetState ;
- ]
- SID_TP_APPLY_TO_SELECTED_SLIDES
- [
- ExecMethod = Execute ;
- StateMethod = GetState ;
- ]
- SID_TP_USE_FOR_NEW_PRESENTATIONS
- [
- ExecMethod = Execute ;
- StateMethod = GetState ;
- ]
- SID_TP_SHOW_SMALL_PREVIEW
- [
- ExecMethod = Execute ;
- StateMethod = GetState ;
- ]
- SID_TP_SHOW_LARGE_PREVIEW
- [
- ExecMethod = Execute ;
- StateMethod = GetState ;
- ]
-
- SID_TP_EDIT_MASTER
- [
- ExecMethod = Execute ;
- StateMethod = GetState ;
- ]
-
- // The copy and paste slots are included here so that they later can be
- // disabled in order to remove them from context menus.
- SID_CUT
- [
- ExecMethod = Execute ;
- StateMethod = GetState ;
- ]
- SID_COPY
- [
- ExecMethod = Execute ;
- StateMethod = GetState ;
- ]
- SID_PASTE
- [
- ExecMethod = Execute ;
- StateMethod = GetState ;
- ]
- SID_DELETE_MASTER_PAGE
- [
- ExecMethod = Execute ;
- StateMethod = GetState ;
- ]
-}
-
-interface TaskPaneLayoutMenuInterface
-{
- SID_TP_APPLY_TO_SELECTED_SLIDES
- [
- ExecMethod = Execute ;
- StateMethod = GetState ;
- ]
- SID_INSERTPAGE_LAYOUT_MENU
- [
- ExecMethod = Execute ;
- StateMethod = GetState ;
- ]
-
- // The copy and paste slots are included here so that they later can be
- // disabled in order to remove them from context menus.
- SID_CUT
- [
- ExecMethod = Execute ;
- StateMethod = GetState ;
- ]
- SID_COPY
- [
- ExecMethod = Execute ;
- StateMethod = GetState ;
- ]
- SID_PASTE
- [
- ExecMethod = Execute ;
- StateMethod = GetState ;
- ]
-}
-
-shell MasterPagesSelector
-{
- import MasterPagesSelectorInterface[Automation];
-}
-
-shell LayoutMenu
-{
- import TaskPaneLayoutMenuInterface[Automation];
-}
-
-shell ToolPanelViewShell
-{
-}
-
diff --git a/sd/sdi/sdslots.sdi b/sd/sdi/sdslots.sdi
index 4176f6f469c0..18ba8895d51a 100644
--- a/sd/sdi/sdslots.sdi
+++ b/sd/sdi/sdslots.sdi
@@ -95,5 +95,4 @@ ModulePrefix( "Sd" )
include "ViewShellBase.sdi"
include "mediaob.sdi"
include "tables.sdi"
- include "ToolPanelViewShell.sdi"
}
diff --git a/sd/source/ui/accessibility/AccessibleScrollPanel.cxx b/sd/source/ui/accessibility/AccessibleScrollPanel.cxx
deleted file mode 100644
index 09bcaa0796ca..000000000000
--- a/sd/source/ui/accessibility/AccessibleScrollPanel.cxx
+++ /dev/null
@@ -1,142 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-
-#include "AccessibleScrollPanel.hxx"
-
-#include "taskpane/ScrollPanel.hxx"
-#include "taskpane/ControlContainer.hxx"
-#include <com/sun/star/accessibility/AccessibleRole.hpp>
-#include <com/sun/star/accessibility/AccessibleStateType.hpp>
-#include <unotools/accessiblestatesethelper.hxx>
-
-#include <osl/mutex.hxx>
-#include <vcl/svapp.hxx>
-
-using namespace ::com::sun::star;
-using namespace ::com::sun::star::accessibility;
-using namespace ::com::sun::star::uno;
-using namespace ::sd::toolpanel;
-
-namespace accessibility {
-
-AccessibleScrollPanel::AccessibleScrollPanel (
- ::sd::toolpanel::ScrollPanel& rScrollPanel,
- const OUString& rsName,
- const OUString& rsDescription)
- : AccessibleTreeNode(
- rScrollPanel,
- rsName,
- rsDescription,
- AccessibleRole::PANEL)
-{
-}
-
-
-
-
-AccessibleScrollPanel::~AccessibleScrollPanel (void)
-{
-}
-
-
-
-
-//===== XAccessibleContext ==================================================
-
-sal_Int32 SAL_CALL
- AccessibleScrollPanel::getAccessibleChildCount (void)
- throw (RuntimeException)
-{
- ThrowIfDisposed();
- const SolarMutexGuard aSolarGuard;
-
- sal_Int32 nChildCount (mrTreeNode.GetControlContainer().GetControlCount());
- if (GetScrollPanel().IsVerticalScrollBarVisible())
- ++nChildCount;
- if (GetScrollPanel().IsHorizontalScrollBarVisible())
- ++nChildCount;
-
- return nChildCount;
-}
-
-
-
-
-Reference<XAccessible> SAL_CALL
- AccessibleScrollPanel::getAccessibleChild (sal_Int32 nIndex)
- throw (lang::IndexOutOfBoundsException,
- RuntimeException)
-{
- ThrowIfDisposed();
- const SolarMutexGuard aSolarGuard;
-
- Reference<XAccessible> xChild;
-
- ScrollPanel& rPanel (GetScrollPanel());
-
- sal_uInt32 nControlCount (mrTreeNode.GetControlContainer().GetControlCount());
-
- // The children of this accessible object include the tree node children
- // and the two scroll bars (when they are visible).
- if (nIndex < 0)
- throw lang::IndexOutOfBoundsException();
- else if ((sal_uInt32)nIndex < nControlCount)
- xChild = AccessibleTreeNode::getAccessibleChild(nIndex);
- else if ((sal_uInt32)nIndex == nControlCount)
- {
- if (rPanel.IsVerticalScrollBarVisible())
- xChild = rPanel.GetVerticalScrollBar().GetAccessible();
- else if (rPanel.IsHorizontalScrollBarVisible())
- xChild = rPanel.GetHorizontalScrollBar().GetAccessible();
- }
- else if ((sal_uInt32)nIndex == nControlCount+1)
- {
- if (rPanel.IsVerticalScrollBarVisible() && rPanel.IsHorizontalScrollBarVisible())
- xChild = rPanel.GetHorizontalScrollBar().GetAccessible();
- }
- else
- throw lang::IndexOutOfBoundsException();
-
- return xChild;
-}
-
-
-
-
-//===== XServiceInfo ========================================================
-
-OUString SAL_CALL
- AccessibleScrollPanel::getImplementationName (void)
- throw (RuntimeException)
-{
- return OUString("AccessibleScrollPanel");
-}
-
-
-
-
-ScrollPanel& AccessibleScrollPanel::GetScrollPanel (void) const
-{
- return static_cast<ScrollPanel&>(mrTreeNode);
-}
-
-} // end of namespace accessibility
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/accessibility/AccessibleTreeNode.cxx b/sd/source/ui/accessibility/AccessibleTreeNode.cxx
deleted file mode 100644
index 282208555d92..000000000000
--- a/sd/source/ui/accessibility/AccessibleTreeNode.cxx
+++ /dev/null
@@ -1,702 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-
-#include "AccessibleTreeNode.hxx"
-
-#include "taskpane/TaskPaneTreeNode.hxx"
-#include "taskpane/ControlContainer.hxx"
-
-#include "sdresid.hxx"
-#include "accessibility.hrc"
-#include <com/sun/star/accessibility/AccessibleRole.hpp>
-#include <com/sun/star/accessibility/AccessibleEventId.hpp>
-#include <comphelper/accessibleeventnotifier.hxx>
-
-#include <vcl/svapp.hxx>
-#include <vcl/window.hxx>
-#include <svtools/colorcfg.hxx>
-
-using namespace ::com::sun::star;
-using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::accessibility;
-using namespace ::sd::toolpanel;
-
-namespace accessibility {
-
-
-
-//===== AccessibleTreeNode =============================================
-
-AccessibleTreeNode::AccessibleTreeNode(
- ::sd::toolpanel::TreeNode& rNode,
- const OUString& rsName,
- const OUString& rsDescription,
- sal_Int16 eRole)
- : AccessibleTreeNodeBase(MutexOwner::maMutex),
- mxParent(NULL),
- mrTreeNode(rNode),
- mrStateSet(new ::utl::AccessibleStateSetHelper()),
- msName(rsName),
- msDescription(rsDescription),
- meRole(eRole),
- mnClientId(0)
-{
- ::Window* pWindow = mrTreeNode.GetWindow();
- if (pWindow != NULL)
- {
- ::Window* pParentWindow = pWindow->GetAccessibleParentWindow();
- if (pParentWindow != NULL && pParentWindow != pWindow)
- mxParent = pParentWindow->GetAccessible();
- }
- CommonConstructor();
-}
-
-
-
-
-void AccessibleTreeNode::CommonConstructor (void)
-{
- UpdateStateSet();
-
- Link aStateChangeLink (LINK(this,AccessibleTreeNode,StateChangeListener));
- mrTreeNode.AddStateChangeListener(aStateChangeLink);
-
- if (mrTreeNode.GetWindow() != NULL)
- {
- Link aWindowEventLink (LINK(this,AccessibleTreeNode,WindowEventListener));
- mrTreeNode.GetWindow()->AddEventListener(aWindowEventLink);
- }
-}
-
-
-
-
-AccessibleTreeNode::~AccessibleTreeNode (void)
-{
- OSL_ASSERT(IsDisposed());
-}
-
-
-
-
-void AccessibleTreeNode::FireAccessibleEvent (
- short nEventId,
- const uno::Any& rOldValue,
- const uno::Any& rNewValue )
-{
- if (mnClientId != 0)
- {
- AccessibleEventObject aEventObject;
-
- aEventObject.Source = Reference<XWeak>(this);
- aEventObject.EventId = nEventId;
- aEventObject.NewValue = rNewValue;
- aEventObject.OldValue = rOldValue;
-
- comphelper::AccessibleEventNotifier::addEvent (mnClientId, aEventObject);
- }
-}
-
-
-
-
-void SAL_CALL AccessibleTreeNode::disposing (void)
-{
- // We are still listening to the tree node and its window. Both
- // probably are by now more or less dead and we must not call them to
- // unregister.
-
- if (mnClientId != 0)
- {
- comphelper::AccessibleEventNotifier::revokeClientNotifyDisposing( mnClientId, *this );
- mnClientId = 0;
- }
-}
-
-
-
-
-//===== XAccessible =========================================================
-
-Reference<XAccessibleContext > SAL_CALL
- AccessibleTreeNode::getAccessibleContext (void)
- throw (uno::RuntimeException)
-{
- ThrowIfDisposed ();
- return this;
-}
-
-
-
-
-//===== XAccessibleContext ==================================================
-
-sal_Int32 SAL_CALL AccessibleTreeNode::getAccessibleChildCount (void)
- throw (RuntimeException)
-{
- ThrowIfDisposed();
- const SolarMutexGuard aSolarGuard;
- return mrTreeNode.GetControlContainer().GetControlCount();
-}
-
-
-
-
-Reference<XAccessible > SAL_CALL
- AccessibleTreeNode::getAccessibleChild (sal_Int32 nIndex)
- throw (lang::IndexOutOfBoundsException, RuntimeException)
-{
- ThrowIfDisposed();
- const SolarMutexGuard aSolarGuard;
-
- if (nIndex<0 || (sal_uInt32)nIndex>=mrTreeNode.GetControlContainer().GetControlCount())
- throw lang::IndexOutOfBoundsException();
-
- Reference<XAccessible> xChild;
-
- ::sd::toolpanel::TreeNode* pNode = mrTreeNode.GetControlContainer().GetControl(nIndex);
- if (pNode != NULL)
- xChild = pNode->GetAccessibleObject();
-
- return xChild;
-}
-
-
-
-
-Reference<XAccessible > SAL_CALL AccessibleTreeNode::getAccessibleParent (void)
- throw (uno::RuntimeException)
-{
- ThrowIfDisposed();
- const SolarMutexGuard aSolarGuard;
- return mxParent;
-}
-
-
-
-
-sal_Int32 SAL_CALL AccessibleTreeNode::getAccessibleIndexInParent (void)
- throw (uno::RuntimeException)
-{
- OSL_ASSERT(getAccessibleParent().is());
- ThrowIfDisposed();
- const SolarMutexGuard aSolarGuard;
- sal_Int32 nIndexInParent(-1);
-
-
- Reference<XAccessibleContext> xParentContext (getAccessibleParent()->getAccessibleContext());
- if (xParentContext.is())
- {
- sal_Int32 nChildCount (xParentContext->getAccessibleChildCount());
- for (sal_Int32 i=0; i<nChildCount; ++i)
- if (xParentContext->getAccessibleChild(i).get()
- == static_cast<XAccessible*>(this))
- {
- nIndexInParent = i;
- break;
- }
- }
-
- return nIndexInParent;
-}
-
-
-
-
-sal_Int16 SAL_CALL AccessibleTreeNode::getAccessibleRole (void)
- throw (uno::RuntimeException)
-{
- ThrowIfDisposed();
- return meRole;
-}
-
-
-
-
-OUString SAL_CALL AccessibleTreeNode::getAccessibleDescription (void)
- throw (uno::RuntimeException)
-{
- ThrowIfDisposed();
- return msDescription;
-}
-
-
-
-
-OUString SAL_CALL AccessibleTreeNode::getAccessibleName (void)
- throw (uno::RuntimeException)
-{
- ThrowIfDisposed();
- return msName;
-}
-
-
-
-
-Reference<XAccessibleRelationSet> SAL_CALL
- AccessibleTreeNode::getAccessibleRelationSet (void)
- throw (uno::RuntimeException)
-{
- ThrowIfDisposed();
- return Reference<XAccessibleRelationSet>();
-}
-
-
-
-
-Reference<XAccessibleStateSet > SAL_CALL
- AccessibleTreeNode::getAccessibleStateSet (void)
- throw (uno::RuntimeException)
-{
- ThrowIfDisposed();
- const SolarMutexGuard aSolarGuard;
- return mrStateSet.get();
-}
-
-
-
-
-void AccessibleTreeNode::UpdateStateSet (void)
-{
- if (mrTreeNode.IsExpandable())
- {
- UpdateState(AccessibleStateType::EXPANDABLE, true);
- UpdateState(AccessibleStateType::EXPANDED, mrTreeNode.IsExpanded());
- }
-
- UpdateState(AccessibleStateType::FOCUSABLE, true);
-
- ::Window* pWindow = mrTreeNode.GetWindow();
- if (pWindow != NULL)
- {
- UpdateState(AccessibleStateType::ENABLED, pWindow->IsEnabled());
- UpdateState(AccessibleStateType::FOCUSED, pWindow->HasFocus());
- UpdateState(AccessibleStateType::VISIBLE, pWindow->IsVisible());
- UpdateState(AccessibleStateType::SHOWING, pWindow->IsReallyVisible());
- }
-}
-
-
-
-
-void AccessibleTreeNode::UpdateState(
- sal_Int16 aState,
- bool bValue)
-{
- if ((mrStateSet->contains(aState)!=sal_False) != bValue)
- {
- if (bValue)
- {
- mrStateSet->AddState(aState);
- FireAccessibleEvent(AccessibleEventId::STATE_CHANGED, Any(),Any(aState));
- }
- else
- {
- mrStateSet->RemoveState(aState);
- FireAccessibleEvent(AccessibleEventId::STATE_CHANGED, Any(aState),Any());
- }
- }
-}
-
-
-
-
-lang::Locale SAL_CALL AccessibleTreeNode::getLocale (void)
- throw (IllegalAccessibleComponentStateException,
- RuntimeException)
-{
- ThrowIfDisposed ();
- Reference<XAccessibleContext> xParentContext;
- Reference<XAccessible> xParent (getAccessibleParent());
- if (xParent.is())
- xParentContext = xParent->getAccessibleContext();
-
- if (xParentContext.is())
- return xParentContext->getLocale();
- else
- // Strange, no parent! Anyway, return the default locale.
- return Application::GetSettings().GetLanguageTag().getLocale();
-}
-
-
-
-
-void SAL_CALL AccessibleTreeNode::addAccessibleEventListener(
- const Reference<XAccessibleEventListener >& rxListener)
- throw (RuntimeException)
-{
- if (rxListener.is())
- {
- const osl::MutexGuard aGuard(maMutex);
-
- if (IsDisposed())
- {
- uno::Reference<uno::XInterface> x ((lang::XComponent *)this, uno::UNO_QUERY);
- rxListener->disposing (lang::EventObject (x));
- }
- else
- {
- if (mnClientId == 0)
- mnClientId = comphelper::AccessibleEventNotifier::registerClient();
- if (mnClientId != 0)
- comphelper::AccessibleEventNotifier::addEventListener(mnClientId, rxListener);
- }
- }
-}
-
-
-
-
-void SAL_CALL AccessibleTreeNode::removeAccessibleEventListener(
- const Reference<XAccessibleEventListener >& rxListener)
- throw (RuntimeException)
-{
- ThrowIfDisposed();
- if (rxListener.is())
- {
- const osl::MutexGuard aGuard(maMutex);
-
- sal_Int32 nListenerCount = comphelper::AccessibleEventNotifier::removeEventListener( mnClientId, rxListener );
- if ( !nListenerCount )
- {
- // no listeners anymore
- // -> revoke ourself. This may lead to the notifier thread dying (if we were the last client),
- // and at least to us not firing any events anymore, in case somebody calls
- // NotifyAccessibleEvent, again
- if (mnClientId != 0)
- {
- comphelper::AccessibleEventNotifier::revokeClient( mnClientId );
- mnClientId = 0;
- }
- }
- }
-}
-
-
-
-
-//===== XAccessibleComponent ==================================================
-
-sal_Bool SAL_CALL AccessibleTreeNode::containsPoint (const awt::Point& aPoint)
- throw (RuntimeException)
-{
- ThrowIfDisposed();
- const awt::Rectangle aBBox (getBounds());
- return (aPoint.X >= 0)
- && (aPoint.X < aBBox.Width)
- && (aPoint.Y >= 0)
- && (aPoint.Y < aBBox.Height);
-}
-
-
-
-
-Reference<XAccessible> SAL_CALL
- AccessibleTreeNode::getAccessibleAtPoint (const awt::Point& aPoint)
- throw (RuntimeException)
-{
- ThrowIfDisposed();
- Reference<XAccessible> xChildAtPoint;
- const SolarMutexGuard aSolarGuard;
-
- sal_Int32 nChildCount = getAccessibleChildCount();
- for (sal_Int32 nIndex=0; nIndex<nChildCount; ++nIndex)
- {
- Reference<XAccessibleComponent> xChildComponent(
- getAccessibleChild(nIndex), UNO_QUERY);
- if (xChildComponent.is())
- {
- awt::Point aChildPoint(aPoint);
- awt::Point aChildOrigin(xChildComponent->getLocation());
- aChildPoint.X -= aChildOrigin.X;
- aChildPoint.Y -= aChildOrigin.Y;
- if (xChildComponent->containsPoint(aChildPoint))
- {
- xChildAtPoint = getAccessibleChild(nIndex);
- break;
- }
- }
- }
-
- return xChildAtPoint;
-}
-
-
-
-
-awt::Rectangle SAL_CALL AccessibleTreeNode::getBounds (void)
- throw (RuntimeException)
-{
- ThrowIfDisposed ();
-
- awt::Rectangle aBBox;
-
- ::Window* pWindow = mrTreeNode.GetWindow();
- if (pWindow != NULL)
- {
- Point aPosition;
- if (mxParent.is())
- {
- aPosition = pWindow->OutputToAbsoluteScreenPixel(Point(0,0));
- Reference<XAccessibleComponent> xParentComponent (
- mxParent->getAccessibleContext(), UNO_QUERY);
- if (xParentComponent.is())
- {
- awt::Point aParentPosition (xParentComponent->getLocationOnScreen());
- aPosition.X() -= aParentPosition.X;
- aPosition.Y() -= aParentPosition.Y;
- }
- }
- else
- aPosition = pWindow->GetPosPixel();
- aBBox.X = aPosition.X();
- aBBox.Y = aPosition.Y();
-
- Size aSize (pWindow->GetSizePixel());
- aBBox.Width = aSize.Width();
- aBBox.Height = aSize.Height();
- }
-
- return aBBox;
-}
-
-
-
-
-awt::Point SAL_CALL AccessibleTreeNode::getLocation (void)
- throw (uno::RuntimeException)
-{
- ThrowIfDisposed();
- const awt::Rectangle aBBox (getBounds());
- return awt::Point(aBBox.X,aBBox.Y);
-}
-
-
-
-
-/** Calculate the location on screen from the parent's location on screen
- and our own relative location.
-*/
-awt::Point SAL_CALL AccessibleTreeNode::getLocationOnScreen()
- throw (uno::RuntimeException)
-{
- ThrowIfDisposed();
- const SolarMutexGuard aSolarGuard;
- awt::Point aLocationOnScreen;
-
- ::Window* pWindow = mrTreeNode.GetWindow();
- if (pWindow != NULL)
- {
- Point aPoint (pWindow->OutputToAbsoluteScreenPixel(Point(0,0)));
- aLocationOnScreen.X = aPoint.X();
- aLocationOnScreen.Y = aPoint.Y();
- }
-
- return aLocationOnScreen;
-}
-
-
-
-
-awt::Size SAL_CALL AccessibleTreeNode::getSize (void)
- throw (uno::RuntimeException)
-{
- ThrowIfDisposed();
- const awt::Rectangle aBBox (getBounds());
- return awt::Size(aBBox.Width,aBBox.Height);
-}
-
-
-
-
-void SAL_CALL AccessibleTreeNode::grabFocus (void)
- throw (uno::RuntimeException)
-{
- ThrowIfDisposed();
- const SolarMutexGuard aSolarGuard;
-
- if (mrTreeNode.GetWindow() != NULL)
- mrTreeNode.GetWindow()->GrabFocus();
-}
-
-
-
-
-sal_Int32 SAL_CALL AccessibleTreeNode::getForeground (void)
- throw (RuntimeException)
-{
- ThrowIfDisposed();
- svtools::ColorConfig aColorConfig;
- sal_uInt32 nColor = aColorConfig.GetColorValue( svtools::FONTCOLOR ).nColor;
- return static_cast<sal_Int32>(nColor);
-}
-
-
-
-
-sal_Int32 SAL_CALL AccessibleTreeNode::getBackground (void)
- throw (RuntimeException)
-{
- ThrowIfDisposed();
- sal_uInt32 nColor = Application::GetSettings().GetStyleSettings().GetWindowColor().GetColor();
- return static_cast<sal_Int32>(nColor);
-}
-
-
-
-
-//===== XServiceInfo ========================================================
-
-OUString SAL_CALL
- AccessibleTreeNode::getImplementationName (void)
- throw (::com::sun::star::uno::RuntimeException)
-{
- return OUString("AccessibleTreeNode");
-}
-
-
-
-
-sal_Bool SAL_CALL
- AccessibleTreeNode::supportsService (const OUString& sServiceName)
- throw (::com::sun::star::uno::RuntimeException)
-{
- ThrowIfDisposed ();
-
- // Iterate over all supported service names and return true if on of them
- // matches the given name.
- uno::Sequence< OUString> aSupportedServices (
- getSupportedServiceNames ());
- for (int i=0; i<aSupportedServices.getLength(); i++)
- if (sServiceName == aSupportedServices[i])
- return sal_True;
- return sal_False;
-}
-
-
-
-
-uno::Sequence< OUString> SAL_CALL
- AccessibleTreeNode::getSupportedServiceNames (void)
- throw (::com::sun::star::uno::RuntimeException)
-{
- ThrowIfDisposed ();
- static const OUString sServiceNames[2] = {
- OUString("com.sun.star.accessibility.Accessible"),
- OUString("com.sun.star.accessibility.AccessibleContext"),
- };
- return uno::Sequence<OUString> (sServiceNames, 2);
-}
-
-
-
-
-void AccessibleTreeNode::ThrowIfDisposed (void)
- throw (lang::DisposedException)
-{
- if (rBHelper.bDisposed || rBHelper.bInDispose)
- {
- OSL_TRACE ("Calling disposed object. Throwing exception:");
- throw lang::DisposedException ("object has been already disposed",
- static_cast<uno::XWeak*>(this));
- }
-}
-
-
-
-sal_Bool AccessibleTreeNode::IsDisposed (void)
-{
- return (rBHelper.bDisposed || rBHelper.bInDispose);
-}
-
-
-
-
-IMPL_LINK(AccessibleTreeNode, StateChangeListener, TreeNodeStateChangeEvent*, pEvent)
-{
- if (rBHelper.bDisposed || rBHelper.bInDispose)
- return 1; // mrTreeNode is probably dead
-
- OSL_ASSERT(pEvent!=NULL);
- OSL_ASSERT(&pEvent->mrSource==&mrTreeNode);
-
- switch(pEvent->meEventId)
- {
- case EID_CHILD_ADDED:
- if (pEvent->mpChild != NULL)
- FireAccessibleEvent(AccessibleEventId::CHILD,
- Any(),
- Any(pEvent->mpChild->GetAccessibleObject()));
- else
- FireAccessibleEvent(AccessibleEventId::INVALIDATE_ALL_CHILDREN,Any(),Any());
- break;
-
- case EID_ALL_CHILDREN_REMOVED:
- FireAccessibleEvent(AccessibleEventId::INVALIDATE_ALL_CHILDREN,Any(),Any());
- break;
-
- case EID_EXPANSION_STATE_CHANGED:
- case EID_FOCUSED_STATE_CHANGED:
- case EID_SHOWING_STATE_CHANGED:
- UpdateStateSet();
- break;
- }
- return 1;
-}
-
-
-
-
-IMPL_LINK(AccessibleTreeNode, WindowEventListener, VclWindowEvent*, pEvent)
-{
- if (rBHelper.bDisposed || rBHelper.bInDispose)
- return 1; // mrTreeNode is probably dead
-
- switch (pEvent->GetId())
- {
- case VCLEVENT_WINDOW_HIDE:
- // This event may be sent while the window is destroyed so do
- // not call UpdateStateSet() which calls back to the window but
- // just set the two states VISIBLE and SHOWING to false.
- UpdateState(AccessibleStateType::VISIBLE, false);
- UpdateState(AccessibleStateType::SHOWING, false);
- break;
-
- case VCLEVENT_WINDOW_SHOW:
- case VCLEVENT_WINDOW_DATACHANGED:
- UpdateStateSet();
- break;
-
- case VCLEVENT_WINDOW_MOVE:
- case VCLEVENT_WINDOW_RESIZE:
- FireAccessibleEvent(AccessibleEventId::BOUNDRECT_CHANGED,Any(),Any());
- break;
-
- case VCLEVENT_WINDOW_GETFOCUS:
- case VCLEVENT_WINDOW_LOSEFOCUS:
- UpdateStateSet();
- break;
- }
- return 1;
-}
-
-} // end of namespace ::accessibility
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/app/sddll1.cxx b/sd/source/ui/app/sddll1.cxx
index 100f52777395..09a7346bc33d 100644
--- a/sd/source/ui/app/sddll1.cxx
+++ b/sd/source/ui/app/sddll1.cxx
@@ -37,7 +37,6 @@
#include "DrawDocShell.hxx"
#include "GraphicDocShell.hxx"
#include "SlideSorterViewShell.hxx"
-#include "taskpane/ToolPanelViewShell.hxx"
#include "FactoryIds.hxx"
#include "sdmod.hxx"
#include "app.hrc"
@@ -115,11 +114,6 @@ void SdDLL::RegisterInterfaces()
// View shells for the side panes.
::sd::slidesorter::SlideSorterViewShell::RegisterInterface (pMod);
-
- ::sd::toolpanel::ToolPanelViewShell::RegisterInterface(pMod);
- // Tell the tool panel view shell to register the interfaces of its
- // controls.
- ::sd::toolpanel::ToolPanelViewShell::RegisterControls();
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/app/sddll2.cxx b/sd/source/ui/app/sddll2.cxx
index a945bfbd99a1..308841523265 100644
--- a/sd/source/ui/app/sddll2.cxx
+++ b/sd/source/ui/app/sddll2.cxx
@@ -126,8 +126,7 @@ void SdDLL::RegisterControllers()
::avmedia::MediaPlayer::RegisterChildWindow(0, pMod);
::sd::LeftPaneImpressChildWindow::RegisterChildWindow(0, pMod);
::sd::LeftPaneDrawChildWindow::RegisterChildWindow(0, pMod);
- ::sd::ToolPanelChildWindow::RegisterChildWindowIfEnabled(0, pMod);
- ::sfx2::sidebar::SidebarChildWindow::RegisterChildWindowIfEnabled(0, pMod);
+ ::sfx2::sidebar::SidebarChildWindow::RegisterChildWindow(0, pMod);
SvxFillToolBoxControl::RegisterControl(0, pMod);
SvxLineStyleToolBoxControl::RegisterControl(0, pMod);
diff --git a/sd/source/ui/dlg/PaneChildWindows.cxx b/sd/source/ui/dlg/PaneChildWindows.cxx
index c82a32679f51..fd8237aa42b0 100644
--- a/sd/source/ui/dlg/PaneChildWindows.cxx
+++ b/sd/source/ui/dlg/PaneChildWindows.cxx
@@ -46,7 +46,6 @@ using ::com::sun::star::drawing::framework::ResourceActivationMode_REPLACE;
SFX_IMPL_DOCKINGWINDOW_WITHID(LeftPaneImpressChildWindow, SID_LEFT_PANE_IMPRESS)
SFX_IMPL_DOCKINGWINDOW_WITHID(LeftPaneDrawChildWindow, SID_LEFT_PANE_DRAW)
-SFX_IMPL_DOCKINGWINDOW_WITHID(ToolPanelChildWindow, SID_TASKPANE)
//===== PaneChildWindow =======================================================
@@ -135,94 +134,6 @@ LeftPaneDrawChildWindow::LeftPaneDrawChildWindow (
{
}
-
-ToolPanelChildWindow::ToolPanelChildWindow( ::Window* i_pParentWindow, sal_uInt16 i_nId, SfxBindings* i_pBindings,
- SfxChildWinInfo* i_pChildWindowInfo )
- :PaneChildWindow( i_pParentWindow, i_nId, i_pBindings, i_pChildWindowInfo,
- FLT_TOOL_PANEL_DOCKING_WINDOW, STR_RIGHT_PANE_TITLE, SFX_ALIGN_RIGHT )
-{
- // just in case this window has been created by SFX, instead our resource framework: Ensure that the resource framework
- // activates the task pane, so it is really filled with content (in opposite to the other SFX applications, the
- // child window registered for SID_TASKPANE is not responsible for its content, but here in SD, it's the ToolPanelViewShell
- // which has this responsibility. And this view shell is created implicitly via the resource framework.)
- // #i113788#
- SfxDockingWindow* pDockingWindow = dynamic_cast< SfxDockingWindow* >( GetWindow() );
- ViewShellBase* pViewShellBase = ViewShellBase::GetViewShellBase( pDockingWindow->GetBindings().GetDispatcher()->GetFrame() );
- ENSURE_OR_RETURN_VOID( pViewShellBase != NULL, "ToolPanelChildWindow::ToolPanelChildWindow: no view shell access!" );
-
- const ::boost::shared_ptr< framework::FrameworkHelper > pFrameworkHelper( framework::FrameworkHelper::Instance( *pViewShellBase ) );
- ENSURE_OR_RETURN_VOID( pFrameworkHelper.get(), "ToolPanelChildWindow::ToolPanelChildWindow: no framework helper for the view shell!" );
- Reference<XConfigurationController> xConfigController( pFrameworkHelper->GetConfigurationController() );
- ENSURE_OR_RETURN_VOID( xConfigController.is(), "ToolPanelChildWindow::ToolPanelChildWindow: no config controller!" );
- xConfigController->requestResourceActivation(
- framework::FrameworkHelper::CreateResourceId( framework::FrameworkHelper::msRightPaneURL ),
- ResourceActivationMode_ADD );
- xConfigController->requestResourceActivation(
- framework::FrameworkHelper::CreateResourceId( framework::FrameworkHelper::msTaskPaneURL, framework::FrameworkHelper::msRightPaneURL ),
- ResourceActivationMode_REPLACE
- );
-}
-
-//----------------------------------------------------------------------------------------------------------------------
-struct DelayedToolPanelActivation
-{
- DelayedToolPanelActivation( ToolPanelChildWindow& i_rToolPanelWindow, const OUString& i_rPanelURL )
- :m_rToolPanelWindow( i_rToolPanelWindow )
- ,m_sPanelURL( i_rPanelURL )
- {
- }
-
- void operator() (bool)
- {
- m_rToolPanelWindow.ActivateToolPanel( m_sPanelURL );
- }
-
-private:
- ToolPanelChildWindow& m_rToolPanelWindow;
- const OUString m_sPanelURL;
-};
-
-//----------------------------------------------------------------------------------------------------------------------
-void ToolPanelChildWindow::ActivateToolPanel( const OUString& i_rPanelURL )
-{
- SfxDockingWindow* pDockingWindow = dynamic_cast< SfxDockingWindow* >( GetWindow() );
- ViewShellBase* pViewShellBase = ViewShellBase::GetViewShellBase( pDockingWindow->GetBindings().GetDispatcher()->GetFrame() );
- ENSURE_OR_RETURN_VOID( pViewShellBase != NULL, "ToolPanelChildWindow::ActivateToolPanel: no view shell access!" );
-
- const ::boost::shared_ptr< framework::FrameworkHelper > pFrameworkHelper( framework::FrameworkHelper::Instance( *pViewShellBase ) );
-
- if ( i_rPanelURL.indexOf( framework::FrameworkHelper::msTaskPanelURLPrefix ) == 0 )
- {
- // it's one of our standard panels known to the drawing framework
- pFrameworkHelper->RequestSidebarPanel( i_rPanelURL );
- }
- else
- {
- // TODO: it would be nice if the drawing framework were able to handle non-standard panels, installed by
- // extensions, too. As long as this is not the case, we need to take the direct way ...
- ::boost::shared_ptr< ViewShell > pViewShell = pFrameworkHelper->GetViewShell( framework::FrameworkHelper::msRightPaneURL );
- toolpanel::ToolPanelViewShell* pToolPanelViewShell = dynamic_cast< toolpanel::ToolPanelViewShell* >( pViewShell.get() );
- if ( pToolPanelViewShell )
- {
- pToolPanelViewShell->ActivatePanel( i_rPanelURL );
- }
- else
- {
- Reference< XResourceId > xTaskPaneResource = pFrameworkHelper->RequestView(
- framework::FrameworkHelper::msTaskPaneURL, framework::FrameworkHelper::msRightPaneURL );
- pFrameworkHelper->RunOnResourceActivation( xTaskPaneResource, DelayedToolPanelActivation( *this, i_rPanelURL ) );
- }
- }
-}
-
-void ToolPanelChildWindow::RegisterChildWindowIfEnabled (sal_Bool bVisible,
- SfxModule *pMod,
- sal_uInt16 nFlags)
-{
- if ( ! SfxViewFrame::IsSidebarEnabled() )
- RegisterChildWindow( bVisible, pMod, nFlags );
-}
-
} // end of namespace ::sd
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/dlg/PaneShells.cxx b/sd/source/ui/dlg/PaneShells.cxx
index d3338ab411d2..023dbcc810a4 100644
--- a/sd/source/ui/dlg/PaneShells.cxx
+++ b/sd/source/ui/dlg/PaneShells.cxx
@@ -92,29 +92,6 @@ LeftDrawPaneShell::~LeftDrawPaneShell (void)
{
}
-//===== ToolPanelPaneShell ========================================================
-
-SFX_SLOTMAP( ToolPanelPaneShell )
-{
- { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
-};
-
-SFX_IMPL_INTERFACE( ToolPanelPaneShell, SfxShell, SdResId( STR_TOOL_PANEL_SHELL ) )
-{
- SFX_CHILDWINDOW_REGISTRATION( ::sd::ToolPanelChildWindow::GetChildWindowId() );
-}
-
-TYPEINIT1( ToolPanelPaneShell, SfxShell );
-
-ToolPanelPaneShell::ToolPanelPaneShell()
- :SfxShell()
-{
- SetName(OUString("ToolPanel"));
-}
-
-ToolPanelPaneShell::~ToolPanelPaneShell(void)
-{
-}
} // end of namespace ::sd
diff --git a/sd/source/ui/framework/factories/BasicPaneFactory.cxx b/sd/source/ui/framework/factories/BasicPaneFactory.cxx
index d74a69715329..904c257650ca 100644
--- a/sd/source/ui/framework/factories/BasicPaneFactory.cxx
+++ b/sd/source/ui/framework/factories/BasicPaneFactory.cxx
@@ -45,8 +45,7 @@ namespace {
CenterPaneId,
FullScreenPaneId,
LeftImpressPaneId,
- LeftDrawPaneId,
- RightPaneId
+ LeftDrawPaneId
};
static const sal_Int32 gnConfigurationUpdateStartEvent(0);
@@ -220,11 +219,6 @@ void SAL_CALL BasicPaneFactory::initialize (const Sequence<Any>& aArguments)
aDescriptor.mePaneId = LeftDrawPaneId;
mpPaneContainer->push_back(aDescriptor);
xCC->addResourceFactory(aDescriptor.msPaneURL, this);
-
- aDescriptor.msPaneURL = FrameworkHelper::msRightPaneURL;
- aDescriptor.mePaneId = RightPaneId;
- mpPaneContainer->push_back(aDescriptor);
- xCC->addResourceFactory(aDescriptor.msPaneURL, this);
}
// Register as configuration change listener.
@@ -293,7 +287,6 @@ Reference<XResource> SAL_CALL BasicPaneFactory::createResource (
case LeftImpressPaneId:
case LeftDrawPaneId:
- case RightPaneId:
xPane = CreateChildWindowPane(
rxPaneId,
*iDescriptor);
@@ -479,11 +472,6 @@ Reference<XResource> BasicPaneFactory::CreateChildWindowPane (
nChildWindowId = ::sd::LeftPaneDrawChildWindow::GetChildWindowId();
break;
- case RightPaneId:
- pShell.reset(new ToolPanelPaneShell());
- nChildWindowId = ::sd::ToolPanelChildWindow::GetChildWindowId();
- break;
-
default:
break;
}
diff --git a/sd/source/ui/framework/factories/BasicPaneFactory.hxx b/sd/source/ui/framework/factories/BasicPaneFactory.hxx
index 472609a17677..de9c81b9d564 100644
--- a/sd/source/ui/framework/factories/BasicPaneFactory.hxx
+++ b/sd/source/ui/framework/factories/BasicPaneFactory.hxx
@@ -59,7 +59,6 @@ namespace sd { namespace framework {
private:resource/pane/FullScreenPane
private:resource/pane/LeftImpressPane
private:resource/pane/LeftDrawPane
- private:resource/pane/RightPane
There are two left panes because this is (seems to be) the only way to
show different titles for the left pane in Draw and Impress.
*/
diff --git a/sd/source/ui/framework/factories/BasicViewFactory.cxx b/sd/source/ui/framework/factories/BasicViewFactory.cxx
index 2e48e175768a..ab0c0b9c9e87 100644
--- a/sd/source/ui/framework/factories/BasicViewFactory.cxx
+++ b/sd/source/ui/framework/factories/BasicViewFactory.cxx
@@ -33,7 +33,6 @@
#include "DrawViewShell.hxx"
#include "GraphicViewShell.hxx"
#include "OutlineViewShell.hxx"
-#include "taskpane/ToolPanelViewShell.hxx"
#include "PresentationViewShell.hxx"
#include "SlideSorterViewShell.hxx"
#include "FrameView.hxx"
@@ -319,7 +318,6 @@ void SAL_CALL BasicViewFactory::initialize (const Sequence<Any>& aArguments)
mxConfigurationController->addResourceFactory(FrameworkHelper::msNotesViewURL, this);
mxConfigurationController->addResourceFactory(FrameworkHelper::msHandoutViewURL, this);
mxConfigurationController->addResourceFactory(FrameworkHelper::msPresentationViewURL, this);
- mxConfigurationController->addResourceFactory(FrameworkHelper::msTaskPaneURL, this);
mxConfigurationController->addResourceFactory(FrameworkHelper::msSlideSorterURL, this);
}
catch (RuntimeException&)
@@ -458,15 +456,6 @@ void SAL_CALL BasicViewFactory::initialize (const Sequence<Any>& aArguments)
pFrameView,
bIsCenterPane);
}
- else if (rsViewURL.equals(FrameworkHelper::msTaskPaneURL))
- {
- pViewShell.reset(
- new ::sd::toolpanel::ToolPanelViewShell(
- &rFrame,
- *mpBase,
- &rWindow,
- pFrameView));
- }
return pViewShell;
}
@@ -533,8 +522,6 @@ bool BasicViewFactory::IsCacheable (const ::boost::shared_ptr<ViewDescriptor>& r
FrameworkHelper::msSlideSorterURL, FrameworkHelper::msLeftDrawPaneURL));
maCacheableResources.push_back(pHelper->CreateResourceId(
FrameworkHelper::msSlideSorterURL, FrameworkHelper::msLeftImpressPaneURL));
- maCacheableResources.push_back(pHelper->CreateResourceId(
- FrameworkHelper::msTaskPaneURL, FrameworkHelper::msRightPaneURL));
}
::std::vector<Reference<XResourceId> >::const_iterator iId;
diff --git a/sd/source/ui/framework/factories/TaskPanelFactory.cxx b/sd/source/ui/framework/factories/TaskPanelFactory.cxx
deleted file mode 100644
index 33fcadf11db3..000000000000
--- a/sd/source/ui/framework/factories/TaskPanelFactory.cxx
+++ /dev/null
@@ -1,312 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#include "TaskPanelFactory.hxx"
-#include "taskpane/ToolPanelViewShell.hxx"
-#include "DrawController.hxx"
-#include "framework/FrameworkHelper.hxx"
-#include <cppuhelper/compbase1.hxx>
-#include <tools/diagnose_ex.h>
-
-using namespace ::com::sun::star;
-using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::lang;
-using namespace ::com::sun::star::drawing::framework;
-
-using ::sd::framework::FrameworkHelper;
-
-namespace sd { namespace framework {
-
-Reference<XInterface> SAL_CALL TaskPanelFactory_createInstance (
- const Reference<XComponentContext>& rxContext)
-{
- return Reference<XInterface>(static_cast<XWeak*>(new TaskPanelFactory(rxContext)));
-}
-
-
-
-
-OUString TaskPanelFactory_getImplementationName (void) throw(RuntimeException)
-{
- return OUString("com.sun.star.comp.Draw.framework.TaskPanelFactory");
-}
-
-
-
-
-Sequence<OUString> SAL_CALL TaskPanelFactory_getSupportedServiceNames (void)
- throw (RuntimeException)
-{
- const OUString sServiceName("com.sun.star.drawing.framework.TaskPanelFactory");
- return Sequence<OUString>(&sServiceName, 1);
-}
-
-
-
-
-//===== ToolPanelResource =====================================================
-
-namespace {
-
-typedef ::cppu::WeakComponentImplHelper1 <
- css::drawing::framework::XResource
- > TaskPanelResourceInterfaceBase;
-
-class TaskPanelResource
- : private ::cppu::BaseMutex,
- public TaskPanelResourceInterfaceBase
-{
-public:
- TaskPanelResource (
- const Reference<XResourceId>& rxResourceId );
- virtual ~TaskPanelResource ();
-
- virtual void SAL_CALL disposing ();
-
- // XResource
-
- virtual Reference<XResourceId> SAL_CALL getResourceId (void)
- throw (css::uno::RuntimeException);
-
- virtual sal_Bool SAL_CALL isAnchorOnly () throw (RuntimeException)
- { return false; }
-
-private:
- const Reference<XResourceId> mxResourceId;
-};
-
-} // end of anonymous namespace.
-
-
-
-
-//===== TaskPanelFactory =======================================================
-
-TaskPanelFactory::TaskPanelFactory (
- const ::com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext>& rxContext)
- : TaskPanelFactoryInterfaceBase(m_aMutex),
- mpViewShellBase(NULL)
-{
- (void)rxContext;
-}
-
-
-
-
-TaskPanelFactory::~TaskPanelFactory (void)
-{
-}
-
-
-
-
-void SAL_CALL TaskPanelFactory::disposing (void)
-{
-}
-
-
-
-
-//===== XInitialization =======================================================
-
-void SAL_CALL TaskPanelFactory::initialize(
- const ::com::sun::star::uno::Sequence<com::sun::star::uno::Any>& aArguments)
- throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException)
-{
- if (aArguments.getLength() > 0)
- {
- try
- {
- // Get the XController from the first argument.
- Reference<frame::XController> xController (aArguments[0], UNO_QUERY_THROW);
-
- // Tunnel through the controller to obtain access to the ViewShellBase.
- try
- {
- Reference<lang::XUnoTunnel> xTunnel (xController, UNO_QUERY_THROW);
- DrawController* pController
- = reinterpret_cast<DrawController*>(
- sal::static_int_cast<sal_uIntPtr>(
- xTunnel->getSomething(DrawController::getUnoTunnelId())));
- if (pController != NULL)
- mpViewShellBase = pController->GetViewShellBase();
-
- }
- catch(RuntimeException&)
- {}
-
- Reference<XControllerManager> xCM (xController, UNO_QUERY_THROW);
- Reference<XConfigurationController> xCC (
- xCM->getConfigurationController(), UNO_QUERY_THROW);
- xCC->addResourceFactory(FrameworkHelper::msMasterPagesTaskPanelURL, this);
- xCC->addResourceFactory(FrameworkHelper::msLayoutTaskPanelURL, this);
- xCC->addResourceFactory(FrameworkHelper::msTableDesignPanelURL, this);
- xCC->addResourceFactory(FrameworkHelper::msCustomAnimationTaskPanelURL, this);
- xCC->addResourceFactory(FrameworkHelper::msSlideTransitionTaskPanelURL, this);
- }
- catch (RuntimeException&)
- {
- }
- }
-}
-
-
-//===== XResourceController ===================================================
-
-namespace
-{
- void lcl_collectResourceURLs( const Reference< XResourceId >& i_rResourceId, ::std::vector< OUString >& o_rResourceURLs )
- {
- ENSURE_OR_RETURN_VOID( i_rResourceId.is(), "illegal resource ID" );
- o_rResourceURLs.resize(0);
-
- Reference< XResourceId > xResourceId( i_rResourceId );
- OUString sResourceURL = xResourceId->getResourceURL();
- while ( !sResourceURL.isEmpty() )
- {
- o_rResourceURLs.push_back( sResourceURL );
- xResourceId = xResourceId->getAnchor();
- sResourceURL = xResourceId->getResourceURL();
- }
- }
-}
-
-Reference<XResource> SAL_CALL TaskPanelFactory::createResource (
- const Reference<XResourceId>& rxResourceId)
- throw (RuntimeException, IllegalArgumentException, WrappedTargetException)
-{
- Reference<XResource> xResource;
-
- if ( ! rxResourceId.is())
- return NULL;
-
- OUString sResourceURL (rxResourceId->getResourceURL());
-
- if ( sResourceURL.match( FrameworkHelper::msTaskPanelURLPrefix ) )
- {
- toolpanel::PanelId ePanelId( toolpanel::GetStandardPanelId( sResourceURL ) );
-
- if ( ( ePanelId != toolpanel::PID_UNKNOWN ) && ( mpViewShellBase != NULL ) )
- {
- ::boost::shared_ptr< FrameworkHelper > pFrameworkHelper( FrameworkHelper::Instance( *mpViewShellBase ) );
-
- // assume that the top-level anchor is the URL of the pane
- ::std::vector< OUString > aResourceURLs;
- lcl_collectResourceURLs( rxResourceId, aResourceURLs );
-
- const OUString sPaneURL = aResourceURLs[ aResourceURLs.size() - 1 ];
- const ::boost::shared_ptr< ViewShell > pPaneViewShell( pFrameworkHelper->GetViewShell( sPaneURL ) );
-
- toolpanel::ToolPanelViewShell* pToolPanel = dynamic_cast< toolpanel::ToolPanelViewShell* >( pPaneViewShell.get() );
- if ( pToolPanel != NULL )
- xResource = new TaskPanelResource( rxResourceId );
-
- OSL_POSTCOND( xResource.is(), "TaskPanelFactory::createResource: did not find the given resource!");
- }
- }
-
- return xResource;
-}
-
-
-
-
-void SAL_CALL TaskPanelFactory::releaseResource (
- const Reference<XResource>& rxResource)
- throw (RuntimeException)
-{
- ENSURE_OR_RETURN_VOID( rxResource.is(), "illegal resource" );
- const Reference< XResourceId > xResourceId( rxResource->getResourceId(), UNO_SET_THROW );
-
- // assume that the top-level anchor is the URL of the pane
- ::std::vector< OUString > aResourceURLs;
- lcl_collectResourceURLs( xResourceId, aResourceURLs );
-
- OSL_ENSURE( !aResourceURLs.empty(), "TaskPanelFactory::releaseResource: illegal resource/URL!" );
- if ( !aResourceURLs.empty() )
- {
- const OUString sPaneURL = aResourceURLs[ aResourceURLs.size() - 1 ];
- ::boost::shared_ptr< FrameworkHelper > pFrameworkHelper( FrameworkHelper::Instance( *mpViewShellBase ) );
- const ::boost::shared_ptr< ViewShell > pPaneViewShell( pFrameworkHelper->GetViewShell( sPaneURL ) );
- if ( pPaneViewShell != 0 )
- {
- const OUString sPanelResourceURL( xResourceId->getResourceURL() );
- const toolpanel::PanelId ePanelId( toolpanel::GetStandardPanelId( sPanelResourceURL ) );
- toolpanel::ToolPanelViewShell* pToolPanel = dynamic_cast< toolpanel::ToolPanelViewShell* >( pPaneViewShell.get() );
-
- if ( ( ePanelId != toolpanel::PID_UNKNOWN )
- && ( pToolPanel != NULL )
- )
- {
- pToolPanel->DeactivatePanel( sPanelResourceURL );
- }
- else
- {
- OSL_FAIL( "TaskPanelFactory::releaseResource: don't know what to do with this resource!" );
- }
- }
- }
-
- Reference<XComponent> xComponent (rxResource, UNO_QUERY);
- if (xComponent.is())
- xComponent->dispose();
-}
-
-
-
-
-//===== ToolPanelResource =====================================================
-
-namespace {
-
-TaskPanelResource::TaskPanelResource (
- const Reference<XResourceId>& rxResourceId)
- : TaskPanelResourceInterfaceBase(m_aMutex),
- mxResourceId(rxResourceId)
-{
-}
-
-
-
-
-TaskPanelResource::~TaskPanelResource (void)
-{
-}
-
-
-
-
-void SAL_CALL TaskPanelResource::disposing ()
-{
-}
-
-
-
-
-Reference<XResourceId> SAL_CALL TaskPanelResource::getResourceId ()
- throw (css::uno::RuntimeException)
-{
- return mxResourceId;
-}
-
-} // end of anonymous namespace
-
-} } // end of namespace sd::framework
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/framework/factories/TaskPanelFactory.hxx b/sd/source/ui/framework/factories/TaskPanelFactory.hxx
deleted file mode 100644
index d23a0378fca0..000000000000
--- a/sd/source/ui/framework/factories/TaskPanelFactory.hxx
+++ /dev/null
@@ -1,88 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#ifndef SD_FRAMEWORK_TASK_PANEL_FACTORY_HXX
-#define SD_FRAMEWORK_TASK_PANEL_FACTORY_HXX
-
-#include <com/sun/star/drawing/framework/XResourceFactory.hpp>
-#include <com/sun/star/lang/XInitialization.hpp>
-#include <com/sun/star/uno/XComponentContext.hpp>
-#include <osl/mutex.hxx>
-#include <cppuhelper/basemutex.hxx>
-#include <cppuhelper/compbase2.hxx>
-
-#include <boost/scoped_ptr.hpp>
-
-namespace {
-
-typedef ::cppu::WeakComponentImplHelper2 <
- css::lang::XInitialization,
- css::drawing::framework::XResourceFactory
- > TaskPanelFactoryInterfaceBase;
-
-} // end of anonymous namespace.
-
-
-namespace sd { class ViewShellBase; }
-
-namespace sd { namespace framework {
-
-/** This class creates panels for the task pane.
-*/
-class TaskPanelFactory
- : private ::cppu::BaseMutex,
- public TaskPanelFactoryInterfaceBase
-{
-public:
- TaskPanelFactory (
- const css::uno::Reference<css::uno::XComponentContext>& rxContext);
- virtual ~TaskPanelFactory (void);
-
- virtual void SAL_CALL disposing (void);
-
-
- // XInitialization
-
- virtual void SAL_CALL initialize(
- const css::uno::Sequence<css::uno::Any>& aArguments)
- throw (css::uno::Exception, css::uno::RuntimeException);
-
-
- // XResourceFactory
-
- virtual css::uno::Reference<css::drawing::framework::XResource>
- SAL_CALL createResource (
- const css::uno::Reference<
- css::drawing::framework::XResourceId>& rxResourcesId)
- throw (css::uno::RuntimeException, css::lang::IllegalArgumentException, css::lang::WrappedTargetException);
-
- virtual void SAL_CALL releaseResource (
- const css::uno::Reference<
- css::drawing::framework::XResource>& rxResource)
- throw (css::uno::RuntimeException);
-
-private:
- ViewShellBase* mpViewShellBase;
-};
-
-} } // end of namespace sd::framework
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/framework/module/ImpressModule.cxx b/sd/source/ui/framework/module/ImpressModule.cxx
index cd417647f5cb..5986e0ab4e32 100644
--- a/sd/source/ui/framework/module/ImpressModule.cxx
+++ b/sd/source/ui/framework/module/ImpressModule.cxx
@@ -17,7 +17,6 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#include "sfx2/viewfrm.hxx"
#include "framework/ImpressModule.hxx"
#include "framework/FrameworkHelper.hxx"
@@ -45,15 +44,9 @@ void ImpressModule::Initialize (Reference<frame::XController>& rxController)
new SlideSorterModule(
rxController,
FrameworkHelper::msLeftImpressPaneURL);
-
- bool bSidebar = SfxViewFrame::IsSidebarEnabled();
new ToolPanelModule(
rxController,
- bSidebar ? FrameworkHelper::msSidebarViewURL :
- FrameworkHelper::msTaskPaneURL,
- bSidebar ? FrameworkHelper::msSidebarPaneURL :
- FrameworkHelper::msRightPaneURL
- );
+ FrameworkHelper::msSidebarViewURL);
new ToolBarModule(rxController);
new ShellStackGuard(rxController);
}
diff --git a/sd/source/ui/framework/module/ToolPanelModule.cxx b/sd/source/ui/framework/module/ToolPanelModule.cxx
index 273a22abe3e8..c607fbd3820a 100644
--- a/sd/source/ui/framework/module/ToolPanelModule.cxx
+++ b/sd/source/ui/framework/module/ToolPanelModule.cxx
@@ -42,10 +42,9 @@ namespace sd { namespace framework {
ToolPanelModule::ToolPanelModule (
const Reference<frame::XController>& rxController,
- const OUString& rsViewURL,
- const OUString& rsPaneURL)
+ const OUString& rsSidebarPaneURL)
: ResourceManager(rxController,
- FrameworkHelper::CreateResourceId(rsViewURL, rsPaneURL)),
+ FrameworkHelper::CreateResourceId(FrameworkHelper::msSidebarViewURL, rsSidebarPaneURL)),
mxControllerManager(rxController,UNO_QUERY)
{
if (mxConfigurationController.is())
diff --git a/sd/source/ui/framework/module/ToolPanelModule.hxx b/sd/source/ui/framework/module/ToolPanelModule.hxx
index 112ffbfff80d..ce28ef826330 100644
--- a/sd/source/ui/framework/module/ToolPanelModule.hxx
+++ b/sd/source/ui/framework/module/ToolPanelModule.hxx
@@ -35,7 +35,7 @@ class ToolPanelModule
public:
ToolPanelModule (
const css::uno::Reference<css::frame::XController>& rxController,
- const OUString& rsViewURL, const OUString& rsPaneURL);
+ const OUString& rsRightPaneURL);
virtual ~ToolPanelModule (void);
virtual void SaveResourceState (void);
diff --git a/sd/source/ui/framework/tools/FrameworkHelper.cxx b/sd/source/ui/framework/tools/FrameworkHelper.cxx
index 76bdae53aae6..2b22a0f12ddd 100644
--- a/sd/source/ui/framework/tools/FrameworkHelper.cxx
+++ b/sd/source/ui/framework/tools/FrameworkHelper.cxx
@@ -19,8 +19,6 @@
#include <osl/time.h>
-#include "sfx2/viewfrm.hxx"
-
#include "framework/FrameworkHelper.hxx"
#include "framework/ConfigurationController.hxx"
@@ -173,7 +171,6 @@ const OUString FrameworkHelper::msCenterPaneURL( msPaneURLPrefix + "CenterPane")
const OUString FrameworkHelper::msFullScreenPaneURL( msPaneURLPrefix + "FullScreenPane");
const OUString FrameworkHelper::msLeftImpressPaneURL( msPaneURLPrefix + "LeftImpressPane");
const OUString FrameworkHelper::msLeftDrawPaneURL( msPaneURLPrefix + "LeftDrawPane");
-const OUString FrameworkHelper::msRightPaneURL( msPaneURLPrefix + "RightPane");
const OUString FrameworkHelper::msSidebarPaneURL( msPaneURLPrefix + "SidebarPane");
@@ -187,7 +184,6 @@ const OUString FrameworkHelper::msNotesViewURL( msViewURLPrefix + "NotesView");
const OUString FrameworkHelper::msHandoutViewURL( msViewURLPrefix + "HandoutView");
const OUString FrameworkHelper::msSlideSorterURL( msViewURLPrefix + "SlideSorter");
const OUString FrameworkHelper::msPresentationViewURL( msViewURLPrefix + "PresentationView");
-const OUString FrameworkHelper::msTaskPaneURL( msViewURLPrefix + "TaskPane");
const OUString FrameworkHelper::msSidebarViewURL( msViewURLPrefix + "SidebarView");
@@ -198,17 +194,10 @@ const OUString FrameworkHelper::msViewTabBarURL( msToolBarURLPrefix + "ViewTabBa
// Task panel URLs.
-// cf. uielementfactorymanager.cxx (WindowContentFactoryManager::RetrieveTypeNameFromResourceURL) which
-// requires the DrawingFramework/ sub-path to get it's lookup right.
-const OUString FrameworkHelper::msTaskPanelURLPrefix("private:resource/toolpanel/DrawingFramework/");
-// const OUString FrameworkHelper::msTaskPanelURLPrefix( "private:resource/toolpanel/" );
-const OUString FrameworkHelper::msMasterPagesTaskPanelURL( msTaskPanelURLPrefix + "MasterPages");
-
-// these three appear to be unused ...
+const OUString FrameworkHelper::msTaskPanelURLPrefix( "private:resource/toolpanel/" );
const OUString FrameworkHelper::msAllMasterPagesTaskPanelURL( msTaskPanelURLPrefix + "AllMasterPages" );
const OUString FrameworkHelper::msRecentMasterPagesTaskPanelURL( msTaskPanelURLPrefix + "RecentMasterPages" );
const OUString FrameworkHelper::msUsedMasterPagesTaskPanelURL( msTaskPanelURLPrefix + "UsedMasterPages" );
-
const OUString FrameworkHelper::msLayoutTaskPanelURL( msTaskPanelURLPrefix + "Layouts" );
const OUString FrameworkHelper::msTableDesignPanelURL( msTaskPanelURLPrefix + "TableDesign" );
const OUString FrameworkHelper::msCustomAnimationTaskPanelURL( msTaskPanelURLPrefix + "CustomAnimations" );
@@ -614,14 +603,6 @@ Reference<XResourceId> FrameworkHelper::RequestSidebarPanel (
const OUString& rsTaskPanelURL,
const bool bEnsureTaskPaneIsVisible)
{
- OUString aViewURL, aPaneURL;
- bool bSidebar = SfxViewFrame::IsSidebarEnabled();
-
- aViewURL = bSidebar ? FrameworkHelper::msSidebarViewURL :
- FrameworkHelper::msTaskPaneURL;
- aPaneURL = bSidebar ? FrameworkHelper::msSidebarPaneURL :
- FrameworkHelper::msRightPaneURL;
-
try
{
if (mxConfigurationController.is())
@@ -633,7 +614,7 @@ Reference<XResourceId> FrameworkHelper::RequestSidebarPanel (
mxConfigurationController->getCurrentConfiguration());
if (xConfiguration.is())
if ( ! xConfiguration->hasResource(
- CreateResourceId(aViewURL, aPaneURL)))
+ CreateResourceId(msSidebarViewURL, msSidebarPaneURL)))
{
// Task pane is not active. Do not force it.
return NULL;
@@ -643,12 +624,12 @@ Reference<XResourceId> FrameworkHelper::RequestSidebarPanel (
// Create the resource id from URLs for the sidebar pane
// and view and the requested panel.
mxConfigurationController->requestResourceActivation(
- CreateResourceId(aPaneURL),
+ CreateResourceId(msSidebarPaneURL),
ResourceActivationMode_ADD);
mxConfigurationController->requestResourceActivation(
- CreateResourceId(aViewURL, aPaneURL),
+ CreateResourceId(msSidebarViewURL, msSidebarPaneURL),
ResourceActivationMode_REPLACE);
- Reference<XResourceId> xPanelId (CreateResourceId(rsTaskPanelURL, aViewURL, aPaneURL));
+ Reference<XResourceId> xPanelId (CreateResourceId(rsTaskPanelURL, msSidebarViewURL, msSidebarPaneURL));
mxConfigurationController->requestResourceActivation(
xPanelId,
ResourceActivationMode_REPLACE);
@@ -677,7 +658,6 @@ ViewShell::ShellType FrameworkHelper::GetViewId (const OUString& rsViewURL)
(*mpViewURLMap)[msHandoutViewURL] = ViewShell::ST_HANDOUT;
(*mpViewURLMap)[msSlideSorterURL] = ViewShell::ST_SLIDE_SORTER;
(*mpViewURLMap)[msPresentationViewURL] = ViewShell::ST_PRESENTATION;
- (*mpViewURLMap)[msTaskPaneURL] = ViewShell::ST_TASK_PANE;
(*mpViewURLMap)[msSidebarViewURL] = ViewShell::ST_SIDEBAR;
}
ViewURLMap::const_iterator iView (mpViewURLMap->find(rsViewURL));
@@ -701,7 +681,6 @@ OUString FrameworkHelper::GetViewURL (ViewShell::ShellType eType)
case ViewShell::ST_HANDOUT : return msHandoutViewURL;
case ViewShell::ST_SLIDE_SORTER : return msSlideSorterURL;
case ViewShell::ST_PRESENTATION : return msPresentationViewURL;
- case ViewShell::ST_TASK_PANE : return msTaskPaneURL;
case ViewShell::ST_SIDEBAR : return msSidebarViewURL;
default:
return OUString();
diff --git a/sd/source/ui/inc/AccessibleScrollPanel.hxx b/sd/source/ui/inc/AccessibleScrollPanel.hxx
deleted file mode 100644
index 47aa7a3734c2..000000000000
--- a/sd/source/ui/inc/AccessibleScrollPanel.hxx
+++ /dev/null
@@ -1,74 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#ifndef SD_ACCESSIBILITY_ACCESSIBLE_SCROLL_PANEL_HXX
-#define SD_ACCESSIBILITY_ACCESSIBLE_SCROLL_PANEL_HXX
-
-#include "AccessibleTreeNode.hxx"
-
-namespace sd { namespace toolpanel {
-class ScrollPanel;
-} }
-
-
-namespace accessibility {
-
-/** This derived class handles the accessible children different from its
- base class. It adds the scroll bars as children when they are visible.
-*/
-class AccessibleScrollPanel
- : public AccessibleTreeNode
-{
-public:
- AccessibleScrollPanel (
- ::sd::toolpanel::ScrollPanel& rScrollPanel,
- const OUString& rsName,
- const OUString& rsDescription);
- ~AccessibleScrollPanel (void);
-
- //===== XAccessibleContext ==============================================
-
- /// Return the number of currently visible children.
- virtual sal_Int32 SAL_CALL
- getAccessibleChildCount (void) throw (::com::sun::star::uno::RuntimeException);
-
- /// Return the specified child or throw exception.
- virtual ::com::sun::star::uno::Reference<
- ::com::sun::star::accessibility::XAccessible> SAL_CALL
- getAccessibleChild (sal_Int32 nIndex)
- throw (::com::sun::star::lang::IndexOutOfBoundsException,
- ::com::sun::star::uno::RuntimeException);
-
- //===== XServiceInfo ====================================================
-
- /** Returns an identifier for the implementation of this object.
- */
- virtual OUString SAL_CALL
- getImplementationName (void)
- throw (::com::sun::star::uno::RuntimeException);
-
-private:
- ::sd::toolpanel::ScrollPanel& GetScrollPanel (void) const;
-};
-
-} // end of namespace accessibility
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/AccessibleTreeNode.hxx b/sd/source/ui/inc/AccessibleTreeNode.hxx
deleted file mode 100644
index f1a3a5094a57..000000000000
--- a/sd/source/ui/inc/AccessibleTreeNode.hxx
+++ /dev/null
@@ -1,292 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#ifndef SD_ACCESSIBILITY_ACCESSIBLE_BASE_HXX
-#define SD_ACCESSIBILITY_ACCESSIBLE_BASE_HXX
-
-#include "MutexOwner.hxx"
-#include <cppuhelper/compbase5.hxx>
-#include <com/sun/star/accessibility/XAccessible.hpp>
-#include <com/sun/star/accessibility/XAccessibleContext.hpp>
-#include <com/sun/star/accessibility/XAccessibleComponent.hpp>
-#include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp>
-#include <com/sun/star/accessibility/AccessibleRole.hpp>
-#include <com/sun/star/accessibility/AccessibleStateType.hpp>
-#include <com/sun/star/lang/XServiceInfo.hpp>
-#include <com/sun/star/lang/DisposedException.hpp>
-#include <com/sun/star/awt/XFocusListener.hpp>
-#include <com/sun/star/document/XEventListener.hpp>
-#include <unotools/accessiblestatesethelper.hxx>
-#include <tools/link.hxx>
-#include <rtl/ref.hxx>
-
-class VclWindowEvent;
-
-namespace sd { namespace toolpanel {
-class TreeNode;
-class TreeNodeStateChangeEvent;
-} }
-
-
-namespace utl {
-class AccessibleStateSetHelper;
-}
-
-namespace accessibility {
-
-
-typedef ::cppu::PartialWeakComponentImplHelper5<
- ::com::sun::star::accessibility::XAccessible,
- ::com::sun::star::accessibility::XAccessibleEventBroadcaster,
- ::com::sun::star::accessibility::XAccessibleContext,
- ::com::sun::star::accessibility::XAccessibleComponent,
- ::com::sun::star::lang::XServiceInfo
- > AccessibleTreeNodeBase;
-
-/** This class makes objects based on the sd::toolpanel::TreeNode
- accessible.
-*/
-class AccessibleTreeNode
- : public ::sd::MutexOwner,
- public AccessibleTreeNodeBase
-{
-public:
- /** Create a new object for the given tree node. The accessible parent
- is taken from the window returned by GetAccessibleParent() when
- called at the window of the node.
- @param rNode
- The TreeNode to make accessible.
- @param rsName
- The accessible name that will be returned by getAccessibleName().
- @param rsDescription
- The accessible description that will be returned by
- getAccessibleDescription().
- @param eRole
- The role that will be returned by getAccessibleRole().
- */
- AccessibleTreeNode(
- ::sd::toolpanel::TreeNode& rNode,
- const OUString& rsName,
- const OUString& rsDescription,
- sal_Int16 eRole);
-
- void FireAccessibleEvent (
- short nEventId,
- const ::com::sun::star::uno::Any& rOldValue,
- const ::com::sun::star::uno::Any& rNewValue);
-
- virtual void SAL_CALL disposing (void);
-
- //===== XComponent =======================================================
-
- virtual void SAL_CALL dispose()throw (::com::sun::star::uno::RuntimeException)
- { WeakComponentImplHelperBase::dispose(); }
- virtual void SAL_CALL addEventListener(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > & xListener)throw (::com::sun::star::uno::RuntimeException)
- { WeakComponentImplHelperBase::addEventListener(xListener); }
- virtual void SAL_CALL removeEventListener(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > & xListener)throw (::com::sun::star::uno::RuntimeException)
- { WeakComponentImplHelperBase::removeEventListener(xListener); }
-
- //===== XAccessible =======================================================
-
- virtual ::com::sun::star::uno::Reference<
- ::com::sun::star::accessibility::XAccessibleContext > SAL_CALL
- getAccessibleContext (void)
- throw (::com::sun::star::uno::RuntimeException);
-
-
- //===== XAccessibleEventBroadcaster =======================================
-
- virtual void SAL_CALL
- addAccessibleEventListener(
- const ::com::sun::star::uno::Reference<
- ::com::sun::star::accessibility::XAccessibleEventListener >& rxListener)
- throw (::com::sun::star::uno::RuntimeException);
-
- virtual void SAL_CALL
- removeAccessibleEventListener(
- const ::com::sun::star::uno::Reference<
- ::com::sun::star::accessibility::XAccessibleEventListener >& rxListener )
- throw (::com::sun::star::uno::RuntimeException);
-
- //===== XAccessibleContext ==============================================
-
- /// Return the number of currently visible children.
- virtual sal_Int32 SAL_CALL
- getAccessibleChildCount (void) throw (::com::sun::star::uno::RuntimeException);
-
- /// Return the specified child or throw exception.
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible> SAL_CALL
- getAccessibleChild (sal_Int32 nIndex)
- throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
-
- /// Return a reference to the parent.
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible> SAL_CALL
- getAccessibleParent (void)
- throw (::com::sun::star::uno::RuntimeException);
-
- /// Return this objects index among the parents children.
- virtual sal_Int32 SAL_CALL
- getAccessibleIndexInParent (void)
- throw (::com::sun::star::uno::RuntimeException);
-
- /// Return this object's role.
- virtual sal_Int16 SAL_CALL
- getAccessibleRole (void)
- throw (::com::sun::star::uno::RuntimeException);
-
- /// Return this object's description.
- virtual OUString SAL_CALL
- getAccessibleDescription (void)
- throw (::com::sun::star::uno::RuntimeException);
-
- /// Return the object's current name.
- virtual OUString SAL_CALL
- getAccessibleName (void)
- throw (::com::sun::star::uno::RuntimeException);
-
- /// Return NULL to indicate that an empty relation set.
- virtual ::com::sun::star::uno::Reference<
- ::com::sun::star::accessibility::XAccessibleRelationSet> SAL_CALL
- getAccessibleRelationSet (void)
- throw (::com::sun::star::uno::RuntimeException);
-
- /// Return the set of current states.
- virtual ::com::sun::star::uno::Reference<
- ::com::sun::star::accessibility::XAccessibleStateSet> SAL_CALL
- getAccessibleStateSet (void)
- throw (::com::sun::star::uno::RuntimeException);
-
- /** Return the parents locale or throw exception if this object has no
- parent yet/anymore.
- */
- virtual ::com::sun::star::lang::Locale SAL_CALL
- getLocale (void)
- throw (::com::sun::star::uno::RuntimeException,
- ::com::sun::star::accessibility::IllegalAccessibleComponentStateException);
-
- //===== XAccessibleComponent ================================================
-
- virtual sal_Bool SAL_CALL containsPoint (
- const ::com::sun::star::awt::Point& aPoint)
- throw (::com::sun::star::uno::RuntimeException);
-
- virtual ::com::sun::star::uno::Reference<
- ::com::sun::star::accessibility::XAccessible > SAL_CALL
- getAccessibleAtPoint (
- const ::com::sun::star::awt::Point& aPoint)
- throw (::com::sun::star::uno::RuntimeException);
-
- virtual ::com::sun::star::awt::Rectangle SAL_CALL getBounds (void)
- throw (::com::sun::star::uno::RuntimeException);
-
- virtual ::com::sun::star::awt::Point SAL_CALL getLocation (void)
- throw (::com::sun::star::uno::RuntimeException);
-
- virtual ::com::sun::star::awt::Point SAL_CALL getLocationOnScreen (void)
- throw (::com::sun::star::uno::RuntimeException);
-
- virtual ::com::sun::star::awt::Size SAL_CALL getSize (void)
- throw (::com::sun::star::uno::RuntimeException);
-
- virtual void SAL_CALL grabFocus (void)
- throw (::com::sun::star::uno::RuntimeException);
-
- virtual sal_Int32 SAL_CALL getForeground (void)
- throw (::com::sun::star::uno::RuntimeException);
-
- virtual sal_Int32 SAL_CALL getBackground (void)
- throw (::com::sun::star::uno::RuntimeException);
-
-
- //===== XServiceInfo ====================================================
-
- /** Returns an identifier for the implementation of this object.
- */
- virtual OUString SAL_CALL
- getImplementationName (void)
- throw (::com::sun::star::uno::RuntimeException);
-
- /** Return whether the specified service is supported by this class.
- */
- virtual sal_Bool SAL_CALL
- supportsService (const OUString& sServiceName)
- throw (::com::sun::star::uno::RuntimeException);
-
- /** Returns a list of all supported services.
- */
- virtual ::com::sun::star::uno::Sequence< OUString> SAL_CALL
- getSupportedServiceNames (void)
- throw (::com::sun::star::uno::RuntimeException);
-
-
-protected:
- ::com::sun::star::uno::Reference<
- ::com::sun::star::accessibility::XAccessible> mxParent;
- ::sd::toolpanel::TreeNode& mrTreeNode;
- ::rtl::Reference< ::utl::AccessibleStateSetHelper> mrStateSet;
-
- const OUString msName;
- const OUString msDescription;
- const sal_Int16 meRole;
-
- virtual ~AccessibleTreeNode (void);
-
- /** Check whether or not the object has been disposed (or is in the
- state of beeing disposed). If that is the case then
- DisposedException is thrown to inform the (indirect) caller of the
- foul deed.
- */
- void ThrowIfDisposed (void)
- throw (::com::sun::star::lang::DisposedException);
-
- /** Check whether or not the object has been disposed (or is in the
- state of beeing disposed).
-
- @return sal_True, if the object is disposed or in the course
- of being disposed. Otherwise, sal_False is returned.
- */
- sal_Bool IsDisposed (void);
-
- /** Update the mpStateSet member to reflect the current state of the
- TreeNode. When one of the states has changed since the last call
- then an appropriate event is sent.
- */
- virtual void UpdateStateSet (void);
-
- /** Update a single state and sent an event if its value changes.
- */
- void UpdateState(
- sal_Int16 aState,
- bool bValue);
-
- DECL_LINK(StateChangeListener, ::sd::toolpanel::TreeNodeStateChangeEvent*);
- DECL_LINK(WindowEventListener, VclWindowEvent*);
-
-private:
- sal_uInt32 mnClientId;
-
- /// The common part of the constructor.
- void CommonConstructor (void);
-};
-
-} // end of namespace ::accessibility
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/PaneChildWindows.hxx b/sd/source/ui/inc/PaneChildWindows.hxx
index dc93ae0f536d..6da8cf18412f 100644
--- a/sd/source/ui/inc/PaneChildWindows.hxx
+++ b/sd/source/ui/inc/PaneChildWindows.hxx
@@ -40,6 +40,9 @@ public:
virtual ~PaneChildWindow (void);
};
+
+
+
class LeftPaneImpressChildWindow
: public PaneChildWindow
{
@@ -49,6 +52,9 @@ public:
SFX_DECL_CHILDWINDOW_WITHID(LeftPaneImpressChildWindow);
};
+
+
+
class LeftPaneDrawChildWindow
: public PaneChildWindow
{
@@ -58,23 +64,6 @@ public:
SFX_DECL_CHILDWINDOW_WITHID(LeftPaneDrawChildWindow);
};
-class ToolPanelChildWindow : public PaneChildWindow
- , public ::sfx2::ITaskPaneToolPanelAccess
-{
-public:
- ToolPanelChildWindow(
- ::Window* i_pParentWindow,
- sal_uInt16 i_nId,
- SfxBindings* i_pBindings,
- SfxChildWinInfo* i_pChildWindowInfo );
-
- SFX_DECL_CHILDWINDOW_WITHID( ToolPanelChildWindow );
-
- static void RegisterChildWindowIfEnabled (sal_Bool bVisible=sal_False, SfxModule *pMod=NULL, sal_uInt16 nFlags=0);
-
- // ::sfx2::ITaskPaneToolPanelAccess
- virtual void ActivateToolPanel( const OUString& i_rPanelURL );
-};
} // end of namespace ::sd
diff --git a/sd/source/ui/inc/ViewShell.hxx b/sd/source/ui/inc/ViewShell.hxx
index 65441d601442..857ec9a0d5b3 100644
--- a/sd/source/ui/inc/ViewShell.hxx
+++ b/sd/source/ui/inc/ViewShell.hxx
@@ -93,7 +93,6 @@ public:
ST_OUTLINE,
ST_SLIDE_SORTER,
ST_PRESENTATION,
- ST_TASK_PANE,
ST_SIDEBAR
};
static const int MAX_HSPLIT_CNT = 1;
diff --git a/sd/source/ui/inc/framework/FrameworkHelper.hxx b/sd/source/ui/inc/framework/FrameworkHelper.hxx
index 4e0b5898f1cc..98f45ce3b606 100644
--- a/sd/source/ui/inc/framework/FrameworkHelper.hxx
+++ b/sd/source/ui/inc/framework/FrameworkHelper.hxx
@@ -66,7 +66,6 @@ public:
static const OUString msFullScreenPaneURL;
static const OUString msLeftImpressPaneURL;
static const OUString msLeftDrawPaneURL;
- static const OUString msRightPaneURL;
static const OUString msSidebarPaneURL;
// URLs of frequently used views.
@@ -78,7 +77,6 @@ public:
static const OUString msHandoutViewURL;
static const OUString msSlideSorterURL;
static const OUString msPresentationViewURL;
- static const OUString msTaskPaneURL;
static const OUString msSidebarViewURL;
// URLs of frequently used tool bars.
@@ -87,7 +85,6 @@ public:
// URLs of task panels.
static const OUString msTaskPanelURLPrefix;
- static const OUString msMasterPagesTaskPanelURL;
static const OUString msAllMasterPagesTaskPanelURL;
static const OUString msRecentMasterPagesTaskPanelURL;
static const OUString msUsedMasterPagesTaskPanelURL;
diff --git a/sd/source/ui/sidebar/PanelFactory.cxx b/sd/source/ui/sidebar/PanelFactory.cxx
index 18295263d842..146263aa1cfb 100644
--- a/sd/source/ui/sidebar/PanelFactory.cxx
+++ b/sd/source/ui/sidebar/PanelFactory.cxx
@@ -1,4 +1,3 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
@@ -35,10 +34,6 @@
#include <vcl/window.hxx>
#include <toolkit/helper/vclunohelper.hxx>
-#include <comphelper/processfactory.hxx>
-#include <comphelper/configuration.hxx>
-#include "officecfg/Office/Common.hxx"
-
using namespace css;
using namespace cssu;
using namespace ::sd::framework;
@@ -74,13 +69,6 @@ Reference<lang::XEventListener> mxControllerDisposeListener;
Reference<XInterface> SAL_CALL PanelFactory_createInstance (
const Reference<XComponentContext>& rxContext)
{
- bool bSidebar = SfxViewFrame::IsSidebarEnabled();
- if (!bSidebar)
- {
- SAL_WARN( "sd", "Creating a disabled sidebar factory" );
- return NULL;
- }
-
return Reference<XInterface>(static_cast<XWeak*>(new PanelFactory(rxContext)));
}
@@ -213,5 +201,3 @@ Reference<ui::XUIElement> SAL_CALL PanelFactory::createUIElement (
} } // end of namespace sd::sidebar
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/toolpanel/ControlContainer.cxx b/sd/source/ui/toolpanel/ControlContainer.cxx
deleted file mode 100644
index 25c3cf30ce67..000000000000
--- a/sd/source/ui/toolpanel/ControlContainer.cxx
+++ /dev/null
@@ -1,437 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-
-#include "taskpane/ControlContainer.hxx"
-
-#include "taskpane/TaskPaneTreeNode.hxx"
-
-#include <vcl/window.hxx>
-#include <vcl/svapp.hxx>
-
-namespace sd { namespace toolpanel {
-
-
-ControlContainer::ControlContainer (TreeNode* pNode)
- : mpNode(pNode),
- mnActiveControlIndex((sal_uInt32)-1),
- mbMultiSelection(false)
-{
-}
-
-
-
-
-ControlContainer::~ControlContainer (void)
-{
- // Set mpNode to NULL so that no one calls it from now on.
- mpNode = NULL;
- DeleteChildren();
-}
-
-
-
-
-void ControlContainer::DeleteChildren (void)
-{
- // Deleting the children may lead to calls back to the container. To
- // prevent the container from accessing the just deleted children, the
- // maControlList member is first cleared (by transferring its content to
- // a local list) before the children are destroyed.
- ControlList maList;
- maList.swap(maControlList);
- ControlList::iterator I;
- ControlList::iterator Iend (maList.end());
- for (I=maList.begin(); I!=Iend; ++I)
- delete *I;
-
- if (mpNode != NULL)
- mpNode->FireStateChangeEvent(EID_ALL_CHILDREN_REMOVED);
-}
-
-
-
-sal_uInt32 ControlContainer::AddControl (::std::auto_ptr<TreeNode> pControl)
-{
- ::osl::MutexGuard aGuard (maMutex);
-
- pControl->GetWindow()->Show();
- sal_uInt32 nIndex = maControlList.size();
- maControlList.push_back (pControl.get());
- pControl.release();
-
- ListHasChanged ();
-
- if (mpNode != NULL)
- mpNode->FireStateChangeEvent(EID_CHILD_ADDED, pControl.get());
-
- return nIndex;
-}
-
-
-
-
-void ControlContainer::SetExpansionState (
- sal_uInt32 nIndex,
- ExpansionState aState)
-{
- ::osl::MutexGuard aGuard (maMutex);
-
- bool bResizeNecessary (false);
-
- if (mbMultiSelection)
- {
- TreeNode* pControl = GetControl(nIndex);
- switch (aState)
- {
- case ES_TOGGLE:
- bResizeNecessary = pControl->Expand( ! pControl->IsExpanded());
- break;
-
- case ES_EXPAND:
- bResizeNecessary = pControl->Expand(true);
- break;
-
- case ES_COLLAPSE:
- bResizeNecessary = pControl->Expand(false);
- break;
- }
- }
- else
- {
- // When bExpansionState is true then the control to expand is the
- // one with the given index. If bExpansionState is false and the
- // given index points to the active control then then following
- // control (in cyclic order) it is expanded. When there is only one
- // control then that is always expanded.
- do
- {
- // Ignore a call with an invalid index. (The separate comparison
- // with -1 is not strictly necessary but it is here just in
- // case.)
- if (nIndex>=GetControlCount() || nIndex==(sal_uInt32)-1)
- break;
-
- bool bExpand;
- switch (aState)
- {
- default:
- case ES_TOGGLE:
- bExpand = ! GetControl(nIndex)->IsExpanded();
- break;
-
- case ES_EXPAND:
- bExpand = true;
- break;
-
- case ES_COLLAPSE:
- bExpand = false;
- break;
- }
- if (bExpand)
- {
- // Make the specified control the active one and expand it.
- mnActiveControlIndex = nIndex;
- }
- else
- {
- if (nIndex == mnActiveControlIndex)
- {
- // We have to determine a new active control since the
- // current one is about to be collapsed. Choose the
- // previous one for the last and the next one for all
- // other.
- if (mnActiveControlIndex+1 == GetControlCount())
- mnActiveControlIndex
- = GetPreviousIndex(mnActiveControlIndex);
- else
- mnActiveControlIndex
- = GetNextIndex (mnActiveControlIndex);
- }
- }
-
- // Update the expansion state of all controls.
- for (sal_uInt32 i=0; i<GetControlCount(); i=GetNextIndex(i))
- {
- TreeNode* pControl = GetControl(i);
- bResizeNecessary |= pControl->Expand(i == mnActiveControlIndex);
- }
- }
- while (false);
- }
-
- if (bResizeNecessary && mpNode != NULL)
- mpNode->RequestResize();
-}
-
-
-
-
-void ControlContainer::SetExpansionState (
- TreeNode* pControl,
- ExpansionState aState)
-{
- SetExpansionState (GetControlIndex(pControl), aState);
-}
-
-
-
-
-sal_uInt32 ControlContainer::GetControlIndex (TreeNode* pControlToExpand) const
-{
- sal_uInt32 nIndex;
- for (nIndex=0; nIndex<GetControlCount(); nIndex++)
- {
- TreeNode* pControl = GetControl(nIndex);
- if (pControl == pControlToExpand)
- break;
- }
- return nIndex;
-}
-
-
-
-
-void ControlContainer::ListHasChanged (void)
-{
-}
-
-
-
-
-sal_uInt32 ControlContainer::GetControlCount (void) const
-{
- return maControlList.size();
-}
-
-
-
-
-sal_uInt32 ControlContainer::GetVisibleControlCount (void) const
-{
- sal_uInt32 nCount (0);
-
- sal_uInt32 nIndex;
- sal_uInt32 nAllCount (maControlList.size());
- for (nIndex=0; nIndex<nAllCount; nIndex=GetNextIndex(nIndex,true))
- {
- if (maControlList[nIndex]->GetWindow()->IsVisible())
- nCount += 1;
- }
-
- return nCount;
-}
-
-
-
-
-TreeNode* ControlContainer::GetControl (sal_uInt32 nIndex) const
-{
- if (nIndex<maControlList.size() && nIndex!=(sal_uInt32)-1)
- return maControlList[nIndex];
- else
- return NULL;
-}
-
-
-
-
-sal_uInt32 ControlContainer::GetPreviousIndex (
- sal_uInt32 nIndex,
- bool bIncludeHidden,
- bool bCycle) const
-{
- sal_uInt32 nCandidate (nIndex);
-
- while (true)
- {
- if (nCandidate==0)
- if ( ! bCycle)
- {
- // We have reached the head of the list of controls and must
- // not cycle to its end.
- nCandidate = maControlList.size();
- break;
- }
- else
- {
- // Cycle to the end of the list.
- nCandidate = maControlList.size() - 1;
- }
- else
- // Go to the regular predecessor.
- nCandidate -= 1;
-
- if (nCandidate == nIndex)
- {
- // Made one full loop and found no valid control.
- nCandidate = maControlList.size();
- break;
- }
- else if (bIncludeHidden)
- {
- // Return the candidate index regardless of whether the control
- // is hidden or not.
- break;
- }
- else if (maControlList[nCandidate]->GetWindow()->IsVisible())
- {
- // Found a visible control.
- break;
- }
-
- // The candidate does not meet our constraints so do one more loop.
- }
-
- return nCandidate;
-}
-
-
-
-sal_uInt32 ControlContainer::GetNextIndex (
- sal_uInt32 nIndex,
- bool bIncludeHidden,
- bool bCycle) const
-{
- sal_uInt32 nCandidate (nIndex);
-
- while (true)
- {
- // Go to the regular successor.
- nCandidate += 1;
- if (nCandidate==maControlList.size())
- {
- if ( ! bCycle)
- {
- // We have reached the end of the list of controls and must
- // not cycle to its head.
- break;
- }
- else
- {
- // Cycle to the head of the list.
- nCandidate = 0;
- }
- }
-
- if (nCandidate == nIndex)
- {
- // Made one full loop and found no valid control.
- nCandidate = maControlList.size();
- break;
- }
- else if (bIncludeHidden)
- {
- // Return the candidate index regardless of whether the control
- // is hidden or not.
- break;
- }
- else if (maControlList[nCandidate]->GetWindow()->IsVisible())
- {
- // Found a visible control.
- break;
- }
-
- // The candidate does not meet our constraints so do one more loop.
- }
-
- return nCandidate;
-}
-
-
-
-
-void ControlContainer::SetMultiSelection (bool bFlag)
-{
- mbMultiSelection = bFlag;
-}
-
-
-
-
-void ControlContainer::SetVisibilityState (
- sal_uInt32 nControlIndex,
- VisibilityState aState)
-{
- TreeNode* pControl = GetControl (nControlIndex);
- if (pControl != NULL)
- {
- bool bShow;
- switch (aState)
- {
- default:
- case VS_TOGGLE:
- bShow = ! pControl->IsShowing();
- break;
- case VS_SHOW:
- bShow = true;
- break;
- case VS_HIDE:
- bShow = false;
- break;
- }
-
- bool bControlWasExpanded = pControl->IsExpanded();
- if (bShow != pControl->IsShowing())
- {
- pControl->Show (bShow);
-
- if (bShow)
- {
- // If we just turned on the first control then expand it, too.
- // If we turned on another control collapse it.
- if (GetVisibleControlCount() == 1)
- SetExpansionState (nControlIndex, ES_EXPAND);
- else
- SetExpansionState (nControlIndex, ES_COLLAPSE);
- }
- else
- {
- if (GetVisibleControlCount() > 0)
- {
- if (bControlWasExpanded)
- {
- // We turned off an expanded control. Make sure that
- // one of the still visible ones is expanded.
- sal_uInt32 nIndex = GetNextIndex(
- nControlIndex,
- false,
- false);
- if (nIndex == GetControlCount())
- nIndex = GetPreviousIndex(
- nControlIndex,
- false,
- false);
- SetExpansionState (nIndex, ES_EXPAND);
- }
- }
- }
-
- if (mpNode != NULL)
- mpNode->RequestResize();
- }
- }
-}
-
-
-
-
-} } // end of namespace ::sd::toolpanel
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/toolpanel/ControlContainerDescriptor.hxx b/sd/source/ui/toolpanel/ControlContainerDescriptor.hxx
deleted file mode 100644
index 19506093cb14..000000000000
--- a/sd/source/ui/toolpanel/ControlContainerDescriptor.hxx
+++ /dev/null
@@ -1,131 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#ifndef SD_TASKPANE_CONTROL_CONTAINER_DESCRIPTOR_HXX
-#define SD_TASKPANE_CONTROL_CONTAINER_DESCRIPTOR_HXX
-
-#include "taskpane/ILayoutableWindow.hxx"
-#include "taskpane/TitleBar.hxx"
-#include <tools/string.hxx>
-#include <tools/gen.hxx>
-#include <vcl/window.hxx>
-#include <memory>
-
-class Window;
-
-namespace sd { namespace toolpanel {
-
-class ControlContainer;
-
-/** Collection of information the describes entries of the tool
- panel. A descriptor owns the control it is associated with.
-*/
-class ControlContainerDescriptor
- : public ::Window,
- public virtual ILayoutableWindow
-{
-public:
- /** Create a new descriptor for the given control.
- @param rContainer
- The container to inform about selection (caused by mouse
- clicks or keyboard.)
- @param pParent
- The parent window of the new descriptor.
- @param pControl
- The control that is shown when being in the expanded
- state.
- @param rTitle
- String that is shown as title in the title area above the
- control.
- @param eType
- Type of the title bar. This specifies how the title bar
- will be formated. For more information see TitleBar.
-
- */
- ControlContainerDescriptor (
- ControlContainer& rContainer,
- ::Window* pParent,
- ::std::auto_ptr<ILayoutableWindow> pControl,
- const OUString& rTitle,
- TitleBar::TitleBarType eType);
-
- virtual ~ControlContainerDescriptor (void);
-
-
- virtual Size GetPreferredSize (void);
- virtual int GetPreferredWidth (int nHeight);
- virtual int GetPreferredHeight (int nWidth);
- virtual bool IsResizable (void);
- virtual ::Window* GetWindow (void);
-
- virtual void Resize (void);
- virtual void GetFocus (void);
- virtual void LoseFocus (void);
- virtual void MouseButtonUp (const MouseEvent& rMouseEvent);
- virtual void KeyInput (const KeyEvent& rEvent);
-
- void Select (bool bExpansionState);
-
- // const Rectangle& GetTitleBarBox (void) const;
-
- Window* GetControl (void) const;
- const OUString& GetTitle (void) const;
-
- void Expand (bool bExpanded = true);
- void Collapse (void);
- bool IsExpanded (void) const;
-
- /** Ownership of the given data remains with the caller. The data
- is thus not destroyed when the destructor of this class is
- called.
- */
- void SetUserData (void* pUserData);
- void* GetUserData (void) const;
-
- bool IsVisible (void) const;
- void SetVisible (bool bVisible);
-
- using Window::GetWindow;
- using sd::toolpanel::ILayoutableWindow::GetPreferredWidth;
- using sd::toolpanel::ILayoutableWindow::GetPreferredHeight;
-
-private:
- ControlContainer& mrContainer;
- ::std::auto_ptr<TitleBar> mpTitleBar;
- ::std::auto_ptr<ILayoutableWindow> mpControl;
- OUString msTitle;
- bool mbExpanded;
- bool mbVisible;
- void* mpUserData;
- bool mnVisible;
-
- /// Do not use! Assignment operator is not supported.
- const ControlContainerDescriptor& operator= (
- const ControlContainerDescriptor& aDescriptor);
-
- void UpdateStates (void);
-
- DECL_LINK(WindowEventListener, VclSimpleEvent*);
-};
-
-} } // end of namespace ::sd::toolpanel
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/toolpanel/LayoutMenu.cxx b/sd/source/ui/toolpanel/LayoutMenu.cxx
deleted file mode 100644
index beb9c39eff1f..000000000000
--- a/sd/source/ui/toolpanel/LayoutMenu.cxx
+++ /dev/null
@@ -1,1002 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-
-#include "LayoutMenu.hxx"
-
-#include "TaskPaneShellManager.hxx"
-#include "pres.hxx"
-#include "drawdoc.hxx"
-#include "DrawDocShell.hxx"
-#include "sdpage.hxx"
-#include "glob.hxx"
-#include "glob.hrc"
-#include "app.hrc"
-#include "helpids.h"
-#include "res_bmp.hrc"
-#include "strings.hrc"
-#include "ViewShellBase.hxx"
-#include "DrawViewShell.hxx"
-#include "SlideSorterViewShell.hxx"
-#include "controller/SlideSorterController.hxx"
-#include "controller/SlsPageSelector.hxx"
-#include "taskpane/TaskPaneControlFactory.hxx"
-#include "taskpane/ToolPanelViewShell.hxx"
-#include "taskpane/ScrollPanel.hxx"
-#include "tools/SlotStateListener.hxx"
-#include "EventMultiplexer.hxx"
-#include "DrawController.hxx"
-#include "framework/FrameworkHelper.hxx"
-
-#include <vector>
-#include <memory>
-#include <sfx2/objface.hxx>
-#include "sdresid.hxx"
-#include <vcl/image.hxx>
-#include <svl/languageoptions.hxx>
-#include <sfx2/app.hxx>
-#include "taskpane/TitledControl.hxx"
-#include <sfx2/dispatch.hxx>
-#include <sfx2/request.hxx>
-#include <comphelper/processfactory.hxx>
-#include <sfx2/viewfrm.hxx>
-
-#include <com/sun/star/frame/XController.hpp>
-#include <com/sun/star/drawing/framework/XControllerManager.hpp>
-#include <com/sun/star/drawing/framework/XView.hpp>
-#include <com/sun/star/drawing/framework/ResourceId.hpp>
-
-using namespace ::sd::toolpanel;
-#define LayoutMenu
-#include "sdslots.hxx"
-
-using namespace ::com::sun::star;
-using namespace ::com::sun::star::text;
-using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::drawing::framework;
-using namespace ::sd::slidesorter;
-using ::sd::framework::FrameworkHelper;
-
-namespace sd { namespace toolpanel {
-
-class LayoutMenuRootFactory
- : public ControlFactory
-{
-public:
- LayoutMenuRootFactory (ToolPanelViewShell& i_rPanelViewShell)
- :mrPanelViewShell(i_rPanelViewShell)
- {
- }
-
-protected:
- virtual TreeNode* InternalCreateControl( ::Window& i_rParent )
- {
- ScrollPanel* pScrollPanel = new ScrollPanel (i_rParent);
- ::std::auto_ptr<TreeNode> pMenu (
- new LayoutMenu (
- pScrollPanel,
- mrPanelViewShell));
- pScrollPanel->AddControl(pMenu);
- return pScrollPanel;
- }
-
-private:
- ToolPanelViewShell& mrPanelViewShell;
-};
-
-
-SFX_IMPL_INTERFACE(LayoutMenu, SfxShell,
- SdResId(STR_TASKPANELAYOUTMENU))
-{
- SFX_POPUPMENU_REGISTRATION(SdResId(RID_TASKPANE_LAYOUTMENU_POPUP));
-}
-
-TYPEINIT1(LayoutMenu, SfxShell);
-
-struct snewfoil_value_info
-{
- sal_uInt16 mnBmpResId;
- sal_uInt16 mnStrResId;
- WritingMode meWritingMode;
- AutoLayout maAutoLayout;
-};
-
-static const snewfoil_value_info notes[] =
-{
- {BMP_FOILN_01, STR_AUTOLAYOUT_NOTES, WritingMode_LR_TB,
- AUTOLAYOUT_NOTES},
- {0, 0, WritingMode_LR_TB, AUTOLAYOUT_NONE},
-};
-
-static const snewfoil_value_info handout[] =
-{
- {BMP_FOILH_01, STR_AUTOLAYOUT_HANDOUT1, WritingMode_LR_TB,
- AUTOLAYOUT_HANDOUT1},
- {BMP_FOILH_02, STR_AUTOLAYOUT_HANDOUT2, WritingMode_LR_TB,
- AUTOLAYOUT_HANDOUT2},
- {BMP_FOILH_03, STR_AUTOLAYOUT_HANDOUT3, WritingMode_LR_TB,
- AUTOLAYOUT_HANDOUT3},
- {BMP_FOILH_04, STR_AUTOLAYOUT_HANDOUT4, WritingMode_LR_TB,
- AUTOLAYOUT_HANDOUT4},
- {BMP_FOILH_06, STR_AUTOLAYOUT_HANDOUT6, WritingMode_LR_TB,
- AUTOLAYOUT_HANDOUT6},
- {BMP_FOILH_09, STR_AUTOLAYOUT_HANDOUT9, WritingMode_LR_TB,
- AUTOLAYOUT_HANDOUT9},
- {0, 0, WritingMode_LR_TB, AUTOLAYOUT_NONE},
-};
-
-static const snewfoil_value_info standard[] =
-{
- {BMP_LAYOUT_EMPTY, STR_AUTOLAYOUT_NONE, WritingMode_LR_TB, AUTOLAYOUT_NONE},
- {BMP_LAYOUT_HEAD03, STR_AUTOLAYOUT_TITLE, WritingMode_LR_TB, AUTOLAYOUT_TITLE},
- {BMP_LAYOUT_HEAD02, STR_AUTOLAYOUT_CONTENT, WritingMode_LR_TB, AUTOLAYOUT_ENUM},
- {BMP_LAYOUT_HEAD02A, STR_AUTOLAYOUT_2CONTENT, WritingMode_LR_TB, AUTOLAYOUT_2TEXT},
- {BMP_LAYOUT_HEAD01, STR_AUTOLAYOUT_ONLY_TITLE, WritingMode_LR_TB, AUTOLAYOUT_ONLY_TITLE},
- {BMP_LAYOUT_TEXTONLY, STR_AUTOLAYOUT_ONLY_TEXT, WritingMode_LR_TB, AUTOLAYOUT_ONLY_TEXT},
- {BMP_LAYOUT_HEAD03B, STR_AUTOLAYOUT_2CONTENT_CONTENT, WritingMode_LR_TB, AUTOLAYOUT_2OBJTEXT},
- {BMP_LAYOUT_HEAD03C, STR_AUTOLAYOUT_CONTENT_2CONTENT, WritingMode_LR_TB, AUTOLAYOUT_TEXT2OBJ},
- {BMP_LAYOUT_HEAD03A, STR_AUTOLAYOUT_2CONTENT_OVER_CONTENT,WritingMode_LR_TB, AUTOLAYOUT_2OBJOVERTEXT},
- {BMP_LAYOUT_HEAD02B, STR_AUTOLAYOUT_CONTENT_OVER_CONTENT, WritingMode_LR_TB, AUTOLAYOUT_OBJOVERTEXT},
- {BMP_LAYOUT_HEAD04, STR_AUTOLAYOUT_4CONTENT, WritingMode_LR_TB, AUTOLAYOUT_4OBJ},
- {BMP_LAYOUT_HEAD06, STR_AUTOLAYOUT_6CONTENT, WritingMode_LR_TB, AUTOLAYOUT_6CLIPART},
-
- // vertical
- {BMP_LAYOUT_VERTICAL02, STR_AL_VERT_TITLE_TEXT_CHART, WritingMode_TB_RL,AUTOLAYOUT_VERTICAL_TITLE_TEXT_CHART},
- {BMP_LAYOUT_VERTICAL01, STR_AL_VERT_TITLE_VERT_OUTLINE, WritingMode_TB_RL, AUTOLAYOUT_VERTICAL_TITLE_VERTICAL_OUTLINE},
- {BMP_LAYOUT_HEAD02, STR_AL_TITLE_VERT_OUTLINE, WritingMode_TB_RL, AUTOLAYOUT_TITLE_VERTICAL_OUTLINE},
- {BMP_LAYOUT_HEAD02A, STR_AL_TITLE_VERT_OUTLINE_CLIPART, WritingMode_TB_RL, AUTOLAYOUT_TITLE_VERTICAL_OUTLINE_CLIPART},
- {0, 0, WritingMode_LR_TB, AUTOLAYOUT_NONE}
-};
-
-LayoutMenu::LayoutMenu( TreeNode* pParent, ToolPanelViewShell& i_rPanelViewShell )
- : ValueSet(pParent->GetWindow(), WB_ITEMBORDER),
- TreeNode(pParent),
- DragSourceHelper(this),
- DropTargetHelper(this),
- mrBase( i_rPanelViewShell.GetViewShellBase() ),
- mpShellManager (&i_rPanelViewShell.GetSubShellManager()),
- mbUseOwnScrollBar( false ),
- mnPreferredColumnCount(3),
- mxListener(NULL),
- mbSelectionUpdatePending(true),
- mbIsMainViewChangePending(false)
-{
- implConstruct( *mrBase.GetDocument()->GetDocSh() );
-}
-
-
-void LayoutMenu::implConstruct( DrawDocShell& rDocumentShell )
-{
- OSL_ENSURE( mrBase.GetDocument()->GetDocSh() == &rDocumentShell,
- "LayoutMenu::implConstruct: hmm?" );
- // if this fires, then my assumption that the rDocumentShell parameter to our first ctor is superfluous ...
-
- SetStyle (
- ( GetStyle() & ~(WB_ITEMBORDER) )
- | WB_TABSTOP
- | WB_NO_DIRECTSELECT
- );
- if (mbUseOwnScrollBar)
- SetStyle (GetStyle() | WB_VSCROLL);
- SetExtraSpacing(2);
- SetSelectHdl (LINK(this, LayoutMenu, ClickHandler));
- SetPool (&rDocumentShell.GetDoc()->GetPool());
- SetName(OUString("LayoutMenu"));
- InvalidateContent();
-
- Link aEventListenerLink (LINK(this,LayoutMenu,EventMultiplexerListener));
- mrBase.GetEventMultiplexer()->AddEventListener(aEventListenerLink,
- ::sd::tools::EventMultiplexerEvent::EID_CURRENT_PAGE
- | ::sd::tools::EventMultiplexerEvent::EID_SLIDE_SORTER_SELECTION
- | ::sd::tools::EventMultiplexerEvent::EID_MAIN_VIEW_ADDED
- | ::sd::tools::EventMultiplexerEvent::EID_MAIN_VIEW_REMOVED
- | ::sd::tools::EventMultiplexerEvent::EID_CONFIGURATION_UPDATED
- | ::sd::tools::EventMultiplexerEvent::EID_EDIT_MODE_NORMAL
- | ::sd::tools::EventMultiplexerEvent::EID_EDIT_MODE_MASTER);
-
- Window::SetHelpId(HID_SD_TASK_PANE_PREVIEW_LAYOUTS);
- SetAccessibleName(SdResId(STR_TASKPANEL_LAYOUT_MENU_TITLE));
-
- Link aStateChangeLink (LINK(this,LayoutMenu,StateChangeHandler));
- mxListener = new ::sd::tools::SlotStateListener(
- aStateChangeLink,
- Reference<frame::XDispatchProvider>(mrBase.GetController()->getFrame(), UNO_QUERY),
- ".uno:VerticalTextState");
-
- // Add this new object as shell to the shell factory.
- GetShellManager()->AddSubShell(SHELLID_SD_TASK_PANE_PREVIEW_LAYOUTS,this,this);
-}
-
-
-
-LayoutMenu::~LayoutMenu (void)
-{
- // Tell the shell factory that this object is no longer available.
- if (GetShellManager() != NULL)
- GetShellManager()->RemoveSubShell(this);
-
- Reference<lang::XComponent> xComponent (mxListener, UNO_QUERY);
- if (xComponent.is())
- xComponent->dispose();
-
- Clear();
- Link aLink (LINK(this,LayoutMenu,EventMultiplexerListener));
- mrBase.GetEventMultiplexer()->RemoveEventListener (aLink);
-}
-
-
-
-
-::std::auto_ptr<ControlFactory> LayoutMenu::CreateControlFactory (
- ToolPanelViewShell& i_rPanelViewShell )
-{
- return ::std::auto_ptr<ControlFactory>(new LayoutMenuRootFactory(i_rPanelViewShell));
-}
-
-
-
-
-AutoLayout LayoutMenu::GetSelectedAutoLayout (void)
-{
- AutoLayout aResult = AUTOLAYOUT_NONE;
-
- if ( ! IsNoSelection() && GetSelectItemId()!=0)
- {
- AutoLayout* pLayout = static_cast<AutoLayout*>(GetItemData(GetSelectItemId()));
- if (pLayout != NULL)
- aResult = *pLayout;
- }
-
- return aResult;
-}
-
-
-
-
-/** The preferred size depends on the preferred number of columns, the
- number of items, and the size of the items.
-*/
-Size LayoutMenu::GetPreferredSize (void)
-{
- Size aItemSize = CalcItemSizePixel (Size());
- Size aPreferredWindowSize = CalcWindowSizePixel (
- aItemSize,
- (sal_uInt16)mnPreferredColumnCount,
- (sal_uInt16)CalculateRowCount (aItemSize,mnPreferredColumnCount));
- return aPreferredWindowSize;
-}
-
-
-
-
-sal_Int32 LayoutMenu::GetPreferredWidth (sal_Int32 nHeight)
-{
- sal_Int32 nPreferredWidth = 100;
- if (GetItemCount() > 0)
- {
- Image aImage = GetItemImage(GetItemId(0));
- Size aItemSize = CalcItemSizePixel (aImage.GetSizePixel());
- if (nHeight>0 && aItemSize.Height()>0)
- {
- int nRowCount = nHeight / aItemSize.Height();
- if (nRowCount <= 0)
- nRowCount = 1;
- int nColumnCount = (GetItemCount() + nRowCount-1) / nRowCount;
- nPreferredWidth = nColumnCount * aItemSize.Width();
- }
- }
-
- return nPreferredWidth;
-}
-
-
-
-
-sal_Int32 LayoutMenu::GetPreferredHeight (sal_Int32 nWidth)
-{
- sal_Int32 nPreferredHeight = 200;
- if ( ! mbUseOwnScrollBar && GetItemCount()>0)
- {
- Image aImage = GetItemImage(GetItemId(0));
- Size aItemSize = CalcItemSizePixel (aImage.GetSizePixel());
- if (nWidth>0 && aItemSize.Width()>0)
- {
- aItemSize.Width() += 8;
- aItemSize.Height() += 8;
- int nColumnCount = nWidth / aItemSize.Width();
- if (nColumnCount <= 0)
- nColumnCount = 1;
- else if (nColumnCount > 4)
- nColumnCount = 4;
- int nRowCount = (GetItemCount() + nColumnCount-1) / nColumnCount;
- nPreferredHeight = nRowCount * aItemSize.Height();
- }
- }
- return nPreferredHeight;
-}
-
-
-
-
-sal_Int32 LayoutMenu::GetMinimumWidth (void)
-{
- sal_Int32 nMinimumWidth = 0;
- if (GetItemCount()>0)
- {
- Image aImage = GetItemImage(GetItemId(0));
- Size aItemSize = CalcItemSizePixel (aImage.GetSizePixel());
- nMinimumWidth = aItemSize.Width();
- }
- return nMinimumWidth;
-}
-
-
-
-
-bool LayoutMenu::IsResizable (void)
-{
- return true;
-}
-
-
-
-
-void LayoutMenu::UpdateEnabledState (const MasterMode eMode)
-{
- bool bIsEnabled (false);
-
- ::boost::shared_ptr<ViewShell> pMainViewShell (mrBase.GetMainViewShell());
- if (pMainViewShell)
- {
- switch (pMainViewShell->GetShellType())
- {
- case ViewShell::ST_NONE:
- case ViewShell::ST_OUTLINE:
- case ViewShell::ST_PRESENTATION:
- case ViewShell::ST_TASK_PANE:
- // The complete task pane is disabled for these values or
- // not even visible. Disabling the LayoutMenu would be
- // logical but unnecessary. The main disadvantage is that
- // after re-enabling it (typically) another panel is
- // expanded.
- bIsEnabled = true;
- break;
-
- case ViewShell::ST_DRAW:
- case ViewShell::ST_IMPRESS:
- {
- switch (eMode)
- {
- case MM_UNKNOWN:
- {
- ::boost::shared_ptr<DrawViewShell> pDrawViewShell (
- ::boost::dynamic_pointer_cast<DrawViewShell>(pMainViewShell));
- if (pDrawViewShell)
- bIsEnabled = pDrawViewShell->GetEditMode() != EM_MASTERPAGE;
- break;
- }
- case MM_NORMAL:
- bIsEnabled = true;
- break;
-
- case MM_MASTER:
- bIsEnabled = false;
- break;
- }
- break;
- }
-
- case ViewShell::ST_HANDOUT:
- case ViewShell::ST_NOTES:
- case ViewShell::ST_SLIDE_SORTER:
- default:
- bIsEnabled = true;
- break;
- }
-
- TreeNode* pParentNode = GetParentNode();
- if (pParentNode != NULL)
- {
- TitledControl* pGrandParentNode
- = dynamic_cast<TitledControl*>(pParentNode->GetParentNode());
- if (pGrandParentNode != NULL)
- pGrandParentNode->SetEnabledState(bIsEnabled);
- }
-
- }
-}
-
-
-
-
-::Window* LayoutMenu::GetWindow (void)
-{
- return this;
-}
-
-
-
-
-void LayoutMenu::Paint (const Rectangle& rRect)
-{
- SetBackground (GetSettings().GetStyleSettings().GetWindowColor());
-
- if (mbSelectionUpdatePending)
- {
- mbSelectionUpdatePending = false;
- UpdateSelection();
- }
- ValueSet::Paint (rRect);
-
- SetBackground (Wallpaper());
-}
-
-
-
-
-void LayoutMenu::Resize (void)
-{
- Size aWindowSize = GetOutputSizePixel();
- if (IsVisible() && aWindowSize.Width() > 0)
- {
- // Calculate the number of rows and columns.
- if (GetItemCount() > 0)
- {
- Image aImage = GetItemImage(GetItemId(0));
- Size aItemSize = CalcItemSizePixel (
- aImage.GetSizePixel());
- aItemSize.Width() += 8;
- aItemSize.Height() += 8;
- int nColumnCount = aWindowSize.Width() / aItemSize.Width();
- if (nColumnCount < 1)
- nColumnCount = 1;
- else if (nColumnCount > 4)
- nColumnCount = 4;
-
- int nRowCount = CalculateRowCount (aItemSize, nColumnCount);
-
- SetColCount ((sal_uInt16)nColumnCount);
- SetLineCount ((sal_uInt16)nRowCount);
- }
- }
-
- ValueSet::Resize ();
-}
-
-
-
-
-void LayoutMenu::MouseButtonDown (const MouseEvent& rEvent)
-{
- // As a preparation for the context menu the item under the mouse is
- // selected.
- if (rEvent.IsRight())
- {
- ReleaseMouse();
- sal_uInt16 nIndex = GetItemId (rEvent.GetPosPixel());
- if (nIndex > 0)
- SelectItem(nIndex);
- }
-
- ValueSet::MouseButtonDown (rEvent);
-}
-
-
-
-
-void LayoutMenu::Execute (SfxRequest& rRequest)
-{
- switch (rRequest.GetSlot())
- {
- case SID_TP_APPLY_TO_SELECTED_SLIDES:
- AssignLayoutToSelectedSlides(GetSelectedAutoLayout());
- rRequest.Done();
- break;
-
- case SID_INSERTPAGE_LAYOUT_MENU:
- // Add arguments to this slot and forward it to the main view
- // shell.
- InsertPageWithLayout(GetSelectedAutoLayout());
- break;
- }
-}
-
-
-
-
-void LayoutMenu::GetState (SfxItemSet& rItemSet)
-{
- // Cut and paste is not supported. The SID_(CUT,COPY,PASTE) entries
- // therefore must not show up in the context menu.
- rItemSet.DisableItem (SID_CUT);
- rItemSet.DisableItem (SID_COPY);
- rItemSet.DisableItem (SID_PASTE);
-
- // The SID_INSERTPAGE_LAYOUT_MENU slot depends on the SID_INSERTPAGE
- // slot being supported elsewhere.
- const SfxPoolItem* pItem = NULL;
- const SfxItemState aState (
- mrBase.GetViewFrame()->GetDispatcher()->QueryState(SID_INSERTPAGE, pItem));
- if (aState == SFX_ITEM_DISABLED)
- rItemSet.DisableItem(SID_INSERTPAGE_LAYOUT_MENU);
-}
-
-
-
-
-void LayoutMenu::InsertPageWithLayout (AutoLayout aLayout)
-{
- ViewShell* pViewShell = mrBase.GetMainViewShell().get();
- if (pViewShell == NULL)
- return;
-
- SfxViewFrame* pViewFrame = mrBase.GetViewFrame();
- if (pViewFrame == NULL)
- return;
-
- SfxDispatcher* pDispatcher = pViewFrame->GetDispatcher();
- if (pDispatcher == NULL)
- return;
-
- // Call SID_INSERTPAGE with the right arguments. This is because
- // the popup menu can not call this slot with arguments directly.
- SfxRequest aRequest (CreateRequest(SID_INSERTPAGE, aLayout));
- if (aRequest.GetArgs() != NULL)
- {
- pDispatcher->Execute(
- SID_INSERTPAGE,
- SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD,
- *aRequest.GetArgs());
- }
- UpdateSelection();
-}
-
-
-
-
-TaskPaneShellManager* LayoutMenu::GetShellManager()
-{
- if ( mpShellManager )
- return mpShellManager;
- return TreeNode::GetShellManager();
-}
-
-void LayoutMenu::InvalidateContent (void)
-{
- // The number of items may have changed. Request a resize so that the
- // vertical size of this control can be adapted.
- RequestResize();
-
- // Throw away the current set and fill the menu anew according to the
- // current settings (this includes the support for vertical writing.)
- Fill();
-}
-
-
-
-
-int LayoutMenu::CalculateRowCount (const Size&, int nColumnCount)
-{
- int nRowCount = 0;
-
- if (GetItemCount() > 0 && nColumnCount > 0)
- {
- nRowCount = (GetItemCount() + nColumnCount - 1) / nColumnCount;
- // nRowCount = GetOutputSizePixel().Height() / rItemSize.Height();
- if (nRowCount < 1)
- nRowCount = 1;
- }
-
- return nRowCount;
-}
-
-
-
-
-IMPL_LINK_NOARG(LayoutMenu, ClickHandler)
-{
- AssignLayoutToSelectedSlides (GetSelectedAutoLayout());
- return 0;
-}
-
-
-
-
-/** The specified layout is assigned to the current page of the view shell
- in the center pane.
-*/
-void LayoutMenu::AssignLayoutToSelectedSlides (AutoLayout aLayout)
-{
- using namespace ::sd::slidesorter;
- using namespace ::sd::slidesorter::controller;
-
- do
- {
- // The view shell in the center pane has to be present.
- ViewShell* pMainViewShell = mrBase.GetMainViewShell().get();
- if (pMainViewShell == NULL)
- break;
-
- // Determine if the current view is in an invalid master page mode.
- // The handout view is always in master page mode and therefore not
- // invalid.
- bool bMasterPageMode (false);
- switch (pMainViewShell->GetShellType())
- {
- case ViewShell::ST_NOTES:
- case ViewShell::ST_IMPRESS:
- {
- DrawViewShell* pDrawViewShell = static_cast<DrawViewShell*>(pMainViewShell);
- if (pDrawViewShell != NULL)
- if (pDrawViewShell->GetEditMode() == EM_MASTERPAGE)
- bMasterPageMode = true;
- }
- default:
- break;
- }
- if (bMasterPageMode)
- break;
-
- // Get a list of all selected slides and call the SID_MODIFYPAGE
- // slot for all of them.
- ::sd::slidesorter::SharedPageSelection pPageSelection;
-
- // Get a list of selected pages.
- // First we try to obtain this list from a slide sorter. This is
- // possible only some of the view shells in the center pane. When
- // no valid slide sorter is available then ask the main view shell
- // for its current page.
- SlideSorterViewShell* pSlideSorter = NULL;
- switch (pMainViewShell->GetShellType())
- {
- case ViewShell::ST_IMPRESS:
- case ViewShell::ST_NOTES:
- case ViewShell::ST_SLIDE_SORTER:
- pSlideSorter = SlideSorterViewShell::GetSlideSorter(mrBase);
- break;
- default:
- break;
- }
- if (pSlideSorter != NULL)
- {
- // There is a slide sorter visible so get the list of selected pages from it.
- pPageSelection = pSlideSorter->GetPageSelection();
- }
-
- if( (pSlideSorter == NULL) || (pPageSelection.get() == 0) || pPageSelection->empty() )
- {
- // No valid slide sorter available. Ask the main view shell for
- // its current page.
- pPageSelection.reset(new ::sd::slidesorter::SlideSorterViewShell::PageSelection());
- pPageSelection->push_back(pMainViewShell->GetActualPage());
- }
-
-
- if (pPageSelection->empty())
- break;
-
- ::std::vector<SdPage*>::iterator iPage;
- for (iPage=pPageSelection->begin(); iPage!=pPageSelection->end(); ++iPage)
- {
- if ((*iPage) == NULL)
- continue;
-
- // Call the SID_ASSIGN_LAYOUT slot with all the necessary parameters.
- SfxRequest aRequest (mrBase.GetViewFrame(), SID_ASSIGN_LAYOUT);
- aRequest.AppendItem(SfxUInt32Item (ID_VAL_WHATPAGE, ((*iPage)->GetPageNum()-1)/2));
- aRequest.AppendItem(SfxUInt32Item (ID_VAL_WHATLAYOUT, aLayout));
- pMainViewShell->ExecuteSlot (aRequest, sal_Bool(sal_False));
- }
- }
- while(false);
-}
-
-
-
-
-SfxRequest LayoutMenu::CreateRequest (
- sal_uInt16 nSlotId,
- AutoLayout aLayout)
-{
- SfxRequest aRequest (mrBase.GetViewFrame(), nSlotId);
-
- do
- {
- SdrLayerAdmin& rLayerAdmin (mrBase.GetDocument()->GetLayerAdmin());
- sal_uInt8 aBackground (rLayerAdmin.GetLayerID(
- SD_RESSTR(STR_LAYER_BCKGRND), sal_False));
- sal_uInt8 aBackgroundObject (rLayerAdmin.GetLayerID(
- SD_RESSTR(STR_LAYER_BCKGRNDOBJ), sal_False));
- ViewShell* pViewShell = mrBase.GetMainViewShell().get();
- if (pViewShell == NULL)
- break;
- SdPage* pPage = pViewShell->GetActualPage();
- if (pPage == NULL)
- break;
-
- SetOfByte aVisibleLayers (pPage->TRG_GetMasterPageVisibleLayers());
-
- aRequest.AppendItem(
- SfxStringItem (ID_VAL_PAGENAME, OUString()));//pPage->GetName()));
- aRequest.AppendItem(SfxUInt32Item (ID_VAL_WHATLAYOUT, aLayout));
- aRequest.AppendItem(
- SfxBoolItem(ID_VAL_ISPAGEBACK, aVisibleLayers.IsSet(aBackground)));
- aRequest.AppendItem(
- SfxBoolItem(
- ID_VAL_ISPAGEOBJ,
- aVisibleLayers.IsSet(aBackgroundObject)));
- }
- while (false);
-
- return aRequest;
-}
-
-
-
-
-void LayoutMenu::Fill (void)
-{
- SvtLanguageOptions aLanguageOptions;
- sal_Bool bVertical = aLanguageOptions.IsVerticalTextEnabled();
- SdDrawDocument* pDocument = mrBase.GetDocument();
- sal_Bool bRightToLeft = (pDocument!=NULL
- && pDocument->GetDefaultWritingMode() == WritingMode_RL_TB);
-
- // Get URL of the view in the center pane.
- OUString sCenterPaneViewName;
- try
- {
- Reference<XControllerManager> xControllerManager (
- Reference<XWeak>(&mrBase.GetDrawController()), UNO_QUERY_THROW);
- Reference<XResourceId> xPaneId (ResourceId::create(
- ::comphelper::getProcessComponentContext(),
- FrameworkHelper::msCenterPaneURL));
- Reference<XView> xView (FrameworkHelper::Instance(mrBase)->GetView(xPaneId));
- if (xView.is())
- sCenterPaneViewName = xView->getResourceId()->getResourceURL();
- }
- catch (RuntimeException&)
- {}
-
- const snewfoil_value_info* pInfo = NULL;
- if (sCenterPaneViewName.equals(framework::FrameworkHelper::msNotesViewURL))
- {
- pInfo = notes;
- }
- else if (sCenterPaneViewName.equals(framework::FrameworkHelper::msHandoutViewURL))
- {
- pInfo = handout;
- }
- else if (sCenterPaneViewName.equals(framework::FrameworkHelper::msImpressViewURL)
- || sCenterPaneViewName.equals(framework::FrameworkHelper::msSlideSorterURL))
- {
- pInfo = standard;
- }
- else
- {
- pInfo = NULL;
- }
-
- Clear();
- int n = 0;
- for (sal_uInt16 i=1; pInfo!=NULL&&pInfo->mnBmpResId!=0; i++,pInfo++)
- {
- if ((WritingMode_TB_RL != pInfo->meWritingMode) || bVertical)
- {
- BitmapEx aBmp(SdResId(pInfo->mnBmpResId));
-
- if (bRightToLeft && (WritingMode_TB_RL != pInfo->meWritingMode))
- aBmp.Mirror (BMP_MIRROR_HORZ);
-
- InsertItem (i, aBmp, SdResId (pInfo->mnStrResId));
- SetItemData (i, new AutoLayout(pInfo->maAutoLayout));
- n++;
- }
- }
-
- mbSelectionUpdatePending = true;
-}
-
-
-
-
-void LayoutMenu::Clear (void)
-{
- for (sal_uInt16 nId=1; nId<=GetItemCount(); nId++)
- delete static_cast<AutoLayout*>(GetItemData(nId));
- ValueSet::Clear();
-}
-
-
-
-void LayoutMenu::StartDrag (sal_Int8 , const Point& )
-{
-}
-
-
-
-
-sal_Int8 LayoutMenu::AcceptDrop (const AcceptDropEvent& )
-{
- return 0;
-}
-
-
-
-
-sal_Int8 LayoutMenu::ExecuteDrop (const ExecuteDropEvent& )
-{
- return 0;
-}
-
-
-
-
-void LayoutMenu::Command (const CommandEvent& rEvent)
-{
- switch (rEvent.GetCommand())
- {
- case COMMAND_CONTEXTMENU:
- if ( ! SD_MOD()->GetWaterCan())
- {
- if (GetShellManager() != NULL)
- GetShellManager()->MoveToTop(this);
- Point aPosition (0,0);
- if (rEvent.IsMouseEvent())
- {
- // Do not show the context menu when the mouse was not
- // pressed over an item.
- // We have to explicitly specify the location of the menu
- // when the LayoutMenu is undocked
- if (GetItemId(rEvent.GetMousePosPixel()) > 0)
- aPosition = rEvent.GetMousePosPixel();
- }
- else
- {
- // When the command event was not caused by a mouse
- // event (for example a key press instead) then show the
- // popup menu at the center of the current item.
- if (GetSelectItemId() != (sal_uInt16)-1)
- {
- Rectangle aBBox (GetItemRect(GetSelectItemId()));
- aPosition = aBBox.Center();
- }
- }
- mrBase.GetViewFrame()->GetDispatcher()->ExecutePopup(
- SdResId(RID_TASKPANE_LAYOUTMENU_POPUP),
- this,
- &aPosition);
- }
- break;
-
- default:
- ValueSet::Command(rEvent);
- break;
- }
-}
-
-
-
-
-IMPL_LINK_NOARG(LayoutMenu, StateChangeHandler)
-{
- InvalidateContent();
- return 0;
-}
-
-
-
-
-void LayoutMenu::UpdateSelection (void)
-{
- bool bItemSelected = false;
-
- do
- {
- // Get current page of main view.
- ViewShell* pViewShell = mrBase.GetMainViewShell().get();
- if (pViewShell == NULL)
- break;
-
- SdPage* pCurrentPage = pViewShell->getCurrentPage();
- if (pCurrentPage == NULL)
- break;
-
- // Get layout of current page.
- AutoLayout aLayout (pCurrentPage->GetAutoLayout());
- if (aLayout<AUTOLAYOUT__START || aLayout>AUTOLAYOUT__END)
- break;
-
- // Find the entry of the menu for to the layout.
- sal_uInt16 nItemCount (GetItemCount());
- for (sal_uInt16 nId=1; nId<=nItemCount; nId++)
- {
- if (*static_cast<AutoLayout*>(GetItemData(nId)) == aLayout)
- {
- SelectItem(nId);
- bItemSelected = true;
- break;
- }
- }
- }
- while (false);
-
- if ( ! bItemSelected)
- SetNoSelection();
-}
-
-
-
-
-IMPL_LINK(LayoutMenu, EventMultiplexerListener, ::sd::tools::EventMultiplexerEvent*, pEvent)
-{
- switch (pEvent->meEventId)
- {
- case ::sd::tools::EventMultiplexerEvent::EID_CURRENT_PAGE:
- case ::sd::tools::EventMultiplexerEvent::EID_SLIDE_SORTER_SELECTION:
- if ( ! mbSelectionUpdatePending)
- UpdateSelection();
- break;
-
- case ::sd::tools::EventMultiplexerEvent::EID_MAIN_VIEW_ADDED:
- mbIsMainViewChangePending = true;
- UpdateEnabledState(MM_UNKNOWN);
- break;
-
- case ::sd::tools::EventMultiplexerEvent::EID_MAIN_VIEW_REMOVED:
- HideFocus();
- break;
-
- case ::sd::tools::EventMultiplexerEvent::EID_CONFIGURATION_UPDATED:
- if (mbIsMainViewChangePending)
- {
- mbIsMainViewChangePending = false;
- InvalidateContent();
- }
- break;
-
- case ::sd::tools::EventMultiplexerEvent::EID_EDIT_MODE_NORMAL:
- UpdateEnabledState(MM_NORMAL);
- break;
-
- case ::sd::tools::EventMultiplexerEvent::EID_EDIT_MODE_MASTER:
- UpdateEnabledState(MM_MASTER);
- break;
-
- default:
- /* Ignored */
- break;
- }
-
- return 0;
-}
-
-
-
-
-void LayoutMenu::DataChanged (const DataChangedEvent& rEvent)
-{
- Fill();
- ValueSet::DataChanged(rEvent);
-}
-
-
-} } // end of namespace ::sd::toolpanel
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/toolpanel/LayoutMenu.hxx b/sd/source/ui/toolpanel/LayoutMenu.hxx
deleted file mode 100644
index a8ef765534d5..000000000000
--- a/sd/source/ui/toolpanel/LayoutMenu.hxx
+++ /dev/null
@@ -1,230 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#ifndef SD_TASKPANE_LAYOUT_MENU_HXX
-#define SD_TASKPANE_LAYOUT_MENU_HXX
-
-#include "taskpane/TaskPaneTreeNode.hxx"
-
-#include <com/sun/star/frame/XStatusListener.hpp>
-
-#include "glob.hxx"
-#include "pres.hxx"
-#include <vcl/ctrl.hxx>
-#include <svtools/valueset.hxx>
-#include <svtools/transfer.hxx>
-#include <sfx2/shell.hxx>
-
-
-class SfxModule;
-
-
-namespace sd {
-class DrawDocShell;
-class ViewShellBase;
-}
-
-
-namespace sd { namespace tools {
-class EventMultiplexerEvent;
-} }
-
-
-namespace sd { namespace toolpanel {
-
-class ControlFactory;
-class ToolPanelViewShell;
-
-
-class LayoutMenu
- : public ValueSet,
- public TreeNode,
- public SfxShell,
- public DragSourceHelper,
- public DropTargetHelper
-{
-public:
- TYPEINFO();
- SFX_DECL_INTERFACE(SD_IF_SDLAYOUTMENU)
-
- /** Create a new layout menu. Depending on the given flag it
- displays its own scroll bar or lets a surrounding window
- handle that.
- @param i_pParent
- the parent node in the control tree
- @param i_rPanelViewShell
- the view shell of the task pane.
- */
- LayoutMenu (
- TreeNode* i_pParent,
- ToolPanelViewShell& i_rPanelViewShell);
- virtual ~LayoutMenu (void);
-
- static std::auto_ptr<ControlFactory> CreateControlFactory (
- ToolPanelViewShell& i_rPanelViewShell );
-
- /** Return a numerical value representing the currently selected
- layout.
- */
- AutoLayout GetSelectedAutoLayout (void);
-
-
- // From ILayoutableWindow
- virtual Size GetPreferredSize (void);
- virtual sal_Int32 GetPreferredWidth (sal_Int32 nHeight);
- virtual sal_Int32 GetPreferredHeight (sal_Int32 nWidth);
- virtual sal_Int32 GetMinimumWidth (void);
- virtual bool IsResizable (void);
- virtual ::Window* GetWindow (void);
-
- // From ::Window
- virtual void Paint (const Rectangle& rRect);
- virtual void Resize (void);
-
- /** Show a context menu when the right mouse button is pressed.
- */
- virtual void MouseButtonDown (const MouseEvent& rEvent);
-
- void Execute (SfxRequest& rRequest);
- void GetState (SfxItemSet& rItemSet);
-
- /** The LayoutMenu does not support some main views. In this case the
- LayoutMenu is disabled. This state is updated in this method.
- @param eMode
- On some occasions the edit mode is being switched when this
- method is called can not (yet) be reliably detected. Luckily,
- in these cases the new value is provided by some broadcaster.
- On other occasions the edit mode is not modified and is also not
- provided. Therefore the Unknown value.
- */
- enum MasterMode { MM_NORMAL, MM_MASTER, MM_UNKNOWN };
- void UpdateEnabledState (const MasterMode eMode);
-
- // TreeNode overridables
- virtual TaskPaneShellManager* GetShellManager (void);
-
- /** Call this method when the set of displayed layouts is not up-to-date
- anymore. It will re-assemple this set according to the current
- settings.
- */
- void InvalidateContent (void);
-
- // DragSourceHelper
- virtual void StartDrag (sal_Int8 nAction, const Point& rPosPixel);
-
- // DropTargetHelper
- virtual sal_Int8 AcceptDrop (const AcceptDropEvent& rEvent);
- virtual sal_Int8 ExecuteDrop (const ExecuteDropEvent& rEvent);
-
- /** The context menu is requested over this Command() method.
- */
- virtual void Command (const CommandEvent& rEvent);
-
- /** Call Fill() when switching to or from high contrast mode so that the
- correct set of icons is displayed.
- */
- virtual void DataChanged (const DataChangedEvent& rEvent);
-
- using Window::GetWindow;
- using ValueSet::StartDrag;
-
-private:
- ViewShellBase& mrBase;
-
- TaskPaneShellManager* mpShellManager;
-
- /** Do we use our own scroll bar or is viewport handling done by
- our parent?
- */
- bool mbUseOwnScrollBar;
-
- /** If we are asked for the preferred window size, then use this
- many columns for the calculation.
- */
- const int mnPreferredColumnCount;
-
- ::com::sun::star::uno::Reference<com::sun::star::frame::XStatusListener> mxListener;
-
- bool mbSelectionUpdatePending;
-
- bool mbIsMainViewChangePending;
-
- /** Calculate the number of displayed rows. This depends on the given
- item size, the given number of columns, and the size of the
- control. Note that this is not the number of rows managed by the
- valueset. This number may be larger. In that case a vertical
- scroll bar is displayed.
- */
- int CalculateRowCount (const Size& rItemSize, int nColumnCount);
-
- /** Fill the value set with the layouts that are applicable to the
- current main view shell.
- */
- void Fill (void);
-
- /** Remove all items from the value set.
- */
- void Clear (void);
-
- /** Assign the given layout to all selected slides of a slide sorter.
- If no slide sorter is active then this call is ignored. The slide
- sorter in the center pane is preferred if the choice exists.
- */
- void AssignLayoutToSelectedSlides (AutoLayout aLayout);
-
- /** Insert a new page with the given layout. The page is inserted via
- the main view shell, i.e. its SID_INSERTPAGE slot is called. It it
- does not support this slot then inserting a new page does not take
- place. The new page is inserted after the currently active one (the
- one returned by ViewShell::GetActualPage().)
- */
- void InsertPageWithLayout (AutoLayout aLayout);
-
- /** Create a request structure that can be used with the SID_INSERTPAGE
- and SID_MODIFYPAGE slots. The parameters are set so that the given
- layout is assigned to the current page of the main view shell.
- @param nSlotId
- Supported slots are SID_INSERTPAGE and SID_MODIFYPAGE.
- @param aLayout
- Layout of the page to insert or to assign.
- */
- SfxRequest CreateRequest (
- sal_uInt16 nSlotId,
- AutoLayout aLayout);
-
- /** Select the layout that is used by the current page.
- */
- void UpdateSelection (void);
-
- // internal ctor
- void implConstruct( DrawDocShell& rDocumentShell );
-
- /** When clicked then set the current page of the view in the center pane.
- */
- DECL_LINK(ClickHandler, void *);
- DECL_LINK(RightClickHandler, MouseEvent*);
- DECL_LINK(StateChangeHandler, void *);
- DECL_LINK(EventMultiplexerListener, ::sd::tools::EventMultiplexerEvent*);
-};
-
-} } // end of namespace ::sd::toolpanel
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/toolpanel/MethodGuard.hxx b/sd/source/ui/toolpanel/MethodGuard.hxx
deleted file mode 100644
index 90f318775d79..000000000000
--- a/sd/source/ui/toolpanel/MethodGuard.hxx
+++ /dev/null
@@ -1,62 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#ifndef SD_METHODGUARD_HXX
-#define SD_METHODGUARD_HXX
-
-#include <osl/mutex.hxx>
-
-//......................................................................................................................
-namespace sd { namespace toolpanel
-{
-//......................................................................................................................
-
- //==================================================================================================================
- //= MethodGuard
- //==================================================================================================================
- template < class COMPONENT >
- class MethodGuard
- {
- public:
- MethodGuard( COMPONENT& i_rComponent )
- :m_aGuard( i_rComponent.getMutex() )
- {
- i_rComponent.checkDisposed();
- }
-
- ~MethodGuard()
- {
- }
-
- inline void clear()
- {
- m_aGuard.clear();
- }
-
- private:
- ::osl::ClearableMutexGuard m_aGuard;
- };
-
-//......................................................................................................................
-} } // namespace sd::toolpanel
-//......................................................................................................................
-
-#endif // SD_METHODGUARD_HXX
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/toolpanel/ScrollPanel.cxx b/sd/source/ui/toolpanel/ScrollPanel.cxx
deleted file mode 100644
index 677f0075081a..000000000000
--- a/sd/source/ui/toolpanel/ScrollPanel.cxx
+++ /dev/null
@@ -1,806 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-
-#include "taskpane/ScrollPanel.hxx"
-
-#include "taskpane/ControlContainer.hxx"
-#include "TaskPaneFocusManager.hxx"
-#include "taskpane/TitledControl.hxx"
-#include "AccessibleScrollPanel.hxx"
-
-#include <vcl/svapp.hxx>
-#include <svtools/valueset.hxx>
-
-namespace sd { namespace toolpanel {
-
-ScrollPanel::ScrollPanel (
- ::Window& i_rParentWindow)
- : Control (&i_rParentWindow, WB_DIALOGCONTROL),
- TreeNode(NULL),
- maScrollWindow(this, WB_DIALOGCONTROL),
- maVerticalScrollBar(this, WB_VERT),
- maHorizontalScrollBar(this, WB_HORZ),
- maScrollBarFiller(this),
- maScrollWindowFiller(&maScrollWindow),
- mbIsRearrangePending(true),
- mbIsLayoutPending(true),
- mnChildrenWidth(0),
- mnVerticalBorder(2),
- mnVerticalGap(3),
- mnHorizontalBorder(2)
-{
- Construct();
-}
-
-void ScrollPanel::Construct()
-{
- SetAccessibleName (OUString("Sub Task Panel"));
- mpControlContainer->SetMultiSelection (true);
-
- SetBorderStyle (WINDOW_BORDER_NORMAL);
- SetMapMode (MapMode(MAP_PIXEL));
-
- // To reduce flickering during repaints make the container windows
- // transparent and rely on their children to paint the whole area.
- SetBackground(Wallpaper());
- maScrollWindow.SetBackground(Wallpaper());
- maScrollWindowFiller.SetBackground(
- Application::GetSettings().GetStyleSettings().GetWindowColor());
-
- maScrollWindow.Show();
-
- // Initialize the scroll bars.
- maVerticalScrollBar.SetScrollHdl (
- LINK(this, ScrollPanel, ScrollBarHandler));
- maVerticalScrollBar.EnableDrag (sal_True);
- maHorizontalScrollBar.SetScrollHdl (
- LINK(this, ScrollPanel, ScrollBarHandler));
- maHorizontalScrollBar.EnableDrag (sal_True);
-}
-
-
-
-
-ScrollPanel::~ScrollPanel (void)
-{
- sal_uInt32 nCount = mpControlContainer->GetControlCount();
- for (sal_uInt32 nIndex=0; nIndex<nCount; nIndex++)
- {
- TreeNode* pNode = mpControlContainer->GetControl(nIndex);
- TreeNode* pControl = pNode;
- // When the node has been created as TitledControl then use its
- // control instead of pNode directly.
- TitledControl* pTitledControl = dynamic_cast<TitledControl*>(pNode);
- if (pTitledControl != NULL)
- pControl = pTitledControl->GetControl();
-
- // Remove this object as listener from the control.
- if (pControl != NULL && pControl->GetWindow()!=NULL)
- {
- pControl->GetWindow()->RemoveEventListener(
- LINK(this,ScrollPanel,WindowEventListener));
- }
- }
- mpControlContainer->DeleteChildren();
-}
-
-
-
-SAL_WNODEPRECATED_DECLARATIONS_PUSH
-TitledControl* ScrollPanel::AddControl (
- ::std::auto_ptr<TreeNode> pControl,
- const OUString& rTitle,
- const OString& rHelpId)
-{
- // We are interested only in the title. The control itself is
- // managed by the content object.
- TitledControl* pTitledControl = new TitledControl(
- this,
- pControl,
- rTitle,
- TitledControlStandardClickHandler(GetControlContainer(), ControlContainer::ES_TOGGLE),
- TitleBar::TBT_SUB_CONTROL_HEADLINE);
- pTitledControl->GetTitleBar()->SetHelpId(rHelpId);
-
- AddControl(::std::auto_ptr<TreeNode>(pTitledControl));
-
- return pTitledControl;
-}
-SAL_WNODEPRECATED_DECLARATIONS_POP
-
-
-SAL_WNODEPRECATED_DECLARATIONS_PUSH
-void ScrollPanel::AddControl (::std::auto_ptr<TreeNode> pControl)
-{
- if (pControl.get() != NULL)
- {
- // Add a window event listener which does two things:
- // 1. Listen for controls being shown or hidden so that the layout
- // can be adapted.
- // 2. Track selection changes in order to make the selected elements
- // visible.
- const Link aWindowListener(LINK(this,ScrollPanel,WindowEventListener));
- OSL_ASSERT(pControl->GetWindow()!=NULL);
- pControl->GetWindow()->AddEventListener(aWindowListener);
-
- TitledControl* pTitledControl = dynamic_cast<TitledControl*>(pControl.get());
- if (pTitledControl != NULL)
- {
- OSL_ASSERT(pTitledControl->GetControl()!=NULL);
- OSL_ASSERT(pTitledControl->GetControl()->GetWindow()!=NULL);
- pTitledControl->GetControl()->GetWindow()->AddEventListener(aWindowListener);
- }
-
- FocusManager& rFocusManager (FocusManager::Instance());
- int nControlCount (mpControlContainer->GetControlCount());
- // Replace the old links for cycling between first and last child by
- // current ones.
- if (nControlCount > 0)
- {
- ::Window* pFirst = mpControlContainer->GetControl(0)->GetWindow();
- ::Window* pLast = mpControlContainer->GetControl(nControlCount-1)->GetWindow();
- rFocusManager.RemoveLinks(pFirst,pLast);
- rFocusManager.RemoveLinks(pLast,pFirst);
-
- rFocusManager.RegisterLink(pFirst,pControl->GetWindow(), KEY_UP);
- rFocusManager.RegisterLink(pControl->GetWindow(),pFirst, KEY_DOWN);
- }
-
-
- // Add a down link only for the first control so that when entering
- // the sub tool panel the focus is set to the first control.
- if (nControlCount == 0)
- rFocusManager.RegisterDownLink(GetParent(), pControl->GetWindow());
- rFocusManager.RegisterUpLink(pControl->GetWindow(), GetParent());
-
- pControl->GetWindow()->SetParent(&maScrollWindow);
- mpControlContainer->AddControl (pControl);
- mpControlContainer->SetExpansionState(
- mpControlContainer->GetControlCount()-1,
- ControlContainer::ES_EXPAND);
- }
-}
-SAL_WNODEPRECATED_DECLARATIONS_POP
-
-
-
-void ScrollPanel::Paint (const Rectangle& rRect)
-{
- if (mbIsRearrangePending)
- Rearrange();
- if (mbIsLayoutPending)
- LayoutChildren();
- ::Window::Paint (rRect);
-
- // Paint the outer border and the space between every two children.
- Color aOriginalLineColor (maScrollWindow.GetLineColor());
- Color aOriginalFillColor (maScrollWindow.GetFillColor());
-
- maScrollWindow.SetLineColor ();
- maScrollWindow.SetFillColor (
- GetSettings().GetStyleSettings().GetWindowColor());
-
- Size aSize (maScrollWindow.GetOutputSizePixel());
- // Paint left and right vertical border.
- Rectangle aVerticalArea (
- Point(0,0),
- Size(mnHorizontalBorder,aSize.Height()));
- maScrollWindow.DrawRect (aVerticalArea);
- aVerticalArea.Right() += mnHorizontalBorder + mnChildrenWidth - 1;
- aVerticalArea.Left() = aVerticalArea.Right() + mnHorizontalBorder;
- maScrollWindow.DrawRect (aVerticalArea);
-
- // Paint horizontal stripes.
- Rectangle aStripeArea (
- Point (mnHorizontalBorder,0),
- Size(mnChildrenWidth,0));
- StripeList::const_iterator iStripe;
- for (iStripe=maStripeList.begin(); iStripe!=maStripeList.end(); ++iStripe)
- {
- aStripeArea.Top() = iStripe->first;
- aStripeArea.Bottom() = iStripe->second;
- if (aStripeArea.Bottom() < 0)
- continue;
- if (aStripeArea.Top() >= aSize.Height())
- break;
- maScrollWindow.DrawRect (aStripeArea);
- }
-
- maScrollWindow.SetLineColor (aOriginalLineColor);
- maScrollWindow.SetFillColor (aOriginalFillColor);
-}
-
-
-
-
-void ScrollPanel::Resize (void)
-{
- ::Window::Resize();
- mbIsRearrangePending = true;
- mbIsLayoutPending = true;
-}
-
-
-
-
-void ScrollPanel::RequestResize (void)
-{
- mbIsRearrangePending = true;
- mbIsLayoutPending = true;
- Invalidate();
-}
-
-
-
-
-Size ScrollPanel::GetPreferredSize (void)
-{
- return GetRequiredSize();
-}
-
-
-
-
-sal_Int32 ScrollPanel::GetPreferredWidth (sal_Int32 )
-{
- return GetPreferredSize().Width();
-}
-
-
-
-
-sal_Int32 ScrollPanel::GetPreferredHeight (sal_Int32 )
-{
- return GetPreferredSize().Height();
-}
-
-
-
-
-bool ScrollPanel::IsResizable (void)
-{
- return true;
-}
-
-
-
-
-::Window* ScrollPanel::GetWindow (void)
-{
- return this;
-}
-
-
-
-
-sal_Int32 ScrollPanel::GetMinimumWidth (void)
-{
- return TreeNode::GetMinimumWidth();
-}
-
-
-
-
-void ScrollPanel::ExpandControl (
- TreeNode* pControl,
- bool bExpansionState)
-{
- // Toggle expand status.
- pControl->Expand (bExpansionState);
-
- Rearrange ();
- Invalidate ();
-}
-
-
-
-
-bool ScrollPanel::IsVerticalScrollBarVisible (void) const
-{
- return maVerticalScrollBar.IsReallyVisible();
-}
-
-
-
-
-bool ScrollPanel::IsHorizontalScrollBarVisible (void) const
-{
- return maHorizontalScrollBar.IsReallyVisible();
-}
-
-
-
-
-ScrollBar& ScrollPanel::GetVerticalScrollBar (void)
-{
- return maVerticalScrollBar;
-}
-
-
-
-
-ScrollBar& ScrollPanel::GetHorizontalScrollBar (void)
-{
- return maHorizontalScrollBar;
-}
-
-
-
-
-/** This control shows an expansion bar for every control and in a
- separate area below that expansion area it shows all controls each
- with its title bar. When there is not enough space then show a
- scroll bar in the control area.
-*/
-void ScrollPanel::Rearrange (void)
-{
- Size aRequiredSize (GetRequiredSize());
- if (aRequiredSize.Width()>0 && aRequiredSize.Height()>0)
- {
- Size aAvailableSize (SetupScrollBars (aRequiredSize));
- maScrollWindow.SetPosSizePixel(
- Point(0,0),
- aAvailableSize);
-
- // Make the children at least as wide as the sub tool panel.
- if (aRequiredSize.Width() < aAvailableSize.Width())
- aRequiredSize.Width() = aAvailableSize.Width();
- mnChildrenWidth = -2*mnHorizontalBorder;
- if (maHorizontalScrollBar.IsVisible())
- mnChildrenWidth += aRequiredSize.Width();
- else
- mnChildrenWidth += aAvailableSize.Width();
-
- sal_Int32 nChildrenHeight (LayoutChildren());
- maVerticalScrollBar.SetRangeMax (
- nChildrenHeight + mnVerticalBorder);
-
- mbIsRearrangePending = false;
- }
-}
-
-
-
-
-Size ScrollPanel::GetRequiredSize (void)
-{
- // First determine the width of the children. This is the maximum of
- // the current window width and the individual minimum widths of the
- // children.
- int nChildrenWidth (GetSizePixel().Width());
- unsigned int nCount = mpControlContainer->GetControlCount();
- unsigned int nIndex;
- for (nIndex=0; nIndex<nCount; nIndex++)
- {
- TreeNode* pChild = mpControlContainer->GetControl (nIndex);
- int nMinimumWidth (pChild->GetMinimumWidth());
- if (nMinimumWidth > nChildrenWidth)
- nChildrenWidth = nMinimumWidth;
- }
-
- // Determine the accumulated width of all children when scaled to the
- // minimum width.
- nChildrenWidth -= 2*mnHorizontalBorder;
- Size aTotalSize (nChildrenWidth,
- 2*mnVerticalBorder + (nCount-1) * mnVerticalGap);
- for (nIndex=0; nIndex<nCount; nIndex++)
- {
- TreeNode* pChild = mpControlContainer->GetControl (nIndex);
- sal_Int32 nHeight = pChild->GetPreferredHeight(nChildrenWidth);
- aTotalSize.Height() += nHeight;
- }
-
- return aTotalSize;
-}
-
-
-
-
-sal_Int32 ScrollPanel::LayoutChildren (void)
-{
- maStripeList.clear();
-
- Point aPosition (maScrollOffset);
- aPosition.X() += mnHorizontalBorder;
- maStripeList.push_back( ::std::pair<int,int>(
- aPosition.Y(),
- aPosition.Y() + mnVerticalBorder - 1));
- aPosition.Y() += mnVerticalBorder;
-
- // Place the controls one over the other.
- unsigned int nCount (mpControlContainer->GetControlCount());
- for (unsigned int nIndex=0; nIndex<nCount; nIndex++)
- {
- if (nIndex > 0)
- {
- maStripeList.push_back( ::std::pair<int,int>(
- aPosition.Y(),
- aPosition.Y() + mnVerticalGap - 1));
- aPosition.Y() += mnVerticalGap;
- }
- TreeNode* pChild = mpControlContainer->GetControl (nIndex);
- int nControlHeight = pChild->GetPreferredHeight(mnChildrenWidth);
- pChild->GetWindow()->SetPosSizePixel(
- aPosition,
- Size(mnChildrenWidth, nControlHeight));
- aPosition.Y() += nControlHeight;
- }
-
- // If the children do not cover their parent window completely
- // (regarding the height) we put a filler below that is responsible for
- // painting the remaining space.
- int nWindowHeight = maScrollWindow.GetSizePixel().Height();
- if (aPosition.Y() < nWindowHeight)
- {
- maScrollWindowFiller.SetPosSizePixel (
- aPosition,
- Size(mnChildrenWidth, nWindowHeight-aPosition.Y()));
- maStripeList.push_back( ::std::pair<int,int>(
- aPosition.Y(),
- nWindowHeight-1));
- // maScrollWindowFiller.Show();
- aPosition.Y() = nWindowHeight;
- }
- else
- maScrollWindowFiller.Hide();
-
- aPosition.Y() += mnVerticalBorder;
- mbIsLayoutPending = false;
-
- return aPosition.Y()-maScrollOffset.Y();
-}
-
-
-
-
-Size ScrollPanel::SetupScrollBars (const Size& rRequiredSize)
-{
- Size aWindowSize (GetSizePixel());
- Size aScrollBarSize (
- maVerticalScrollBar.GetSizePixel().Width(),
- maHorizontalScrollBar.GetSizePixel().Height());
- Size aRemainingSize (aWindowSize);
-
- // Determine which scroll bars have to be shown.
- bool bShowHorizontal = false;
- if (rRequiredSize.Width() > aWindowSize.Width())
- bShowHorizontal = true;
- bool bShowVertical = false;
- if (rRequiredSize.Height() > aWindowSize.Height())
- bShowVertical = true;
- // Showing one scroll bar may reduce the available size so that the
- // other one has to be shown as well.
- if (bShowHorizontal && ! bShowVertical)
- {
- if ((rRequiredSize.Height() + aScrollBarSize.Height())
- > aWindowSize.Height())
- bShowVertical = true;
- }
- else if (bShowVertical && ! bShowHorizontal)
- {
- if (GetMinimumWidth() + aScrollBarSize.Width() > aWindowSize.Width())
- bShowHorizontal = true;
- }
-
- // Setup the scroll bars.
- aRemainingSize.Width()
- = SetupVerticalScrollBar (bShowVertical, rRequiredSize.Height());
- aRemainingSize.Height()
- = SetupHorizontalScrollBar (bShowHorizontal, rRequiredSize.Width());
-
- // Place the filler.
- if (bShowHorizontal && bShowVertical)
- {
- maScrollBarFiller.SetPosSizePixel (
- Point(aWindowSize.Width(), aWindowSize.Height()),
- aScrollBarSize);
- maScrollBarFiller.Show();
- }
- else
- maScrollBarFiller.Hide();
-
-
- return aRemainingSize;
-}
-
-
-
-
-sal_Int32 ScrollPanel::SetupVerticalScrollBar (bool bShow, sal_Int32 nRange)
-{
- Size aScrollBarSize (
- maVerticalScrollBar.GetSizePixel().Width(),
- maHorizontalScrollBar.GetSizePixel().Height());
- Size aWindowSize (GetOutputSizePixel());
- sal_Int32 nRemainingWidth (aWindowSize.Width());
-
- // Setup the verical scroll bar.
- if (bShow)
- {
- int nWidth = aScrollBarSize.Width();
- int nHeight = aWindowSize.Height();
- maVerticalScrollBar.SetPosSizePixel(
- Point(aWindowSize.Width()-nWidth,0),
- Size(nWidth, nHeight));
- maVerticalScrollBar.Show();
-
- // Set the scroll bar range and thumb size.
- maVerticalScrollBar.SetRangeMin (0);
- maVerticalScrollBar.SetRangeMax (
- nRange + 2*mnVerticalBorder);
- maVerticalScrollBar.SetVisibleSize (aWindowSize.Height());
- // Make page size approx. 10% of visible area.
- maVerticalScrollBar.SetLineSize (aWindowSize.Height()/10);
- // Make page size approx. 100% of visible area.
- maVerticalScrollBar.SetPageSize (aWindowSize.Height());
- // Make sure that thumb is inside the valid range.
- maVerticalScrollBar.SetThumbPos(-maScrollOffset.Y());
- long nMinPos = maVerticalScrollBar.GetRangeMin();
- if (maVerticalScrollBar.GetThumbPos() < nMinPos)
- maVerticalScrollBar.SetThumbPos(nMinPos);
- long nMaxPos = maVerticalScrollBar.GetRangeMax()
- - maVerticalScrollBar.GetVisibleSize();
- if (maVerticalScrollBar.GetThumbPos() >= nMaxPos)
- maVerticalScrollBar.SetThumbPos(nMaxPos);
- // Set offset to match thumb pos.
- maScrollOffset.Y() = -maVerticalScrollBar.GetThumbPos();
-
- nRemainingWidth -= aScrollBarSize.Width();
- }
- else
- {
- maVerticalScrollBar.Hide();
- maScrollOffset.Y() = 0;
- }
-
- return nRemainingWidth;
-}
-
-
-
-
-sal_Int32 ScrollPanel::SetupHorizontalScrollBar (bool bShow, sal_Int32 nRange)
-{
- Size aScrollBarSize (
- maVerticalScrollBar.GetSizePixel().Width(),
- maHorizontalScrollBar.GetSizePixel().Height());
- Size aWindowSize (GetOutputSizePixel());
- sal_Int32 nRemainingHeight (aWindowSize.Height());
-
- // Setup the horizontal scroll bar.
- if (bShow)
- {
- int nHeight = aScrollBarSize.Height();
- int nWidth = GetOutputSizePixel().Width();
- maHorizontalScrollBar.SetPosSizePixel(
- Point(0, aWindowSize.Height()-nHeight),
- Size(nWidth,nHeight));
- maHorizontalScrollBar.Show();
-
- // Set the scroll bar range and thumb size.
- maHorizontalScrollBar.SetRangeMin (0);
- maHorizontalScrollBar.SetRangeMax (
- nRange + 2*mnHorizontalBorder);
- maHorizontalScrollBar.SetVisibleSize (aWindowSize.Width());
- // Make page size approx. 5% of visible area.
- maHorizontalScrollBar.SetLineSize (aWindowSize.Width()/20+1);
- // Make page size approx. 50% of visible area.
- maHorizontalScrollBar.SetPageSize (aWindowSize.Width()/2+1);
- // Make sure that thumb is inside the valid range.
- maHorizontalScrollBar.SetThumbPos(-maScrollOffset.X());
- long nMinPos = maHorizontalScrollBar.GetRangeMin();
- if (maHorizontalScrollBar.GetThumbPos() < nMinPos)
- maHorizontalScrollBar.SetThumbPos(nMinPos);
- long nMaxPos = maHorizontalScrollBar.GetRangeMax()
- - maHorizontalScrollBar.GetVisibleSize();
- if (maHorizontalScrollBar.GetThumbPos() >= nMaxPos)
- maHorizontalScrollBar.SetThumbPos(nMaxPos);
- // Set offset to match thumb pos.
- maScrollOffset.X() = -maHorizontalScrollBar.GetThumbPos();
-
- nRemainingHeight -= aScrollBarSize.Height();
- }
- else
- {
- maHorizontalScrollBar.Hide();
- maScrollOffset.X() = 0;
- }
-
- return nRemainingHeight;
-}
-
-
-IMPL_LINK_NOARG(ScrollPanel, ScrollBarHandler)
-{
- maScrollOffset.X() -= maHorizontalScrollBar.GetDelta();
- maScrollOffset.Y() -= maVerticalScrollBar.GetDelta();
-
- // Scrolling is done by moving the child windows up or down.
- mbIsLayoutPending = true;
- Invalidate();
- // LayoutChildren();
-
- return 0;
-}
-
-
-
-
-long ScrollPanel::Notify( NotifyEvent& rNEvt )
-{
- long nRet = sal_False;
- if( rNEvt.GetType() == EVENT_COMMAND )
- {
- // note: dynamic_cast is not possible as GetData() returns a void*
- CommandEvent* pCmdEvent = reinterpret_cast< CommandEvent* >(rNEvt.GetData());
- DBG_ASSERT( pCmdEvent!=0 &&
- ( pCmdEvent->IsMouseEvent() == sal_True ||
- pCmdEvent->IsMouseEvent() == sal_False ),
- "Invalid CommandEvent" );
- if (pCmdEvent)
- switch (pCmdEvent->GetCommand())
- {
- case COMMAND_WHEEL:
- case COMMAND_STARTAUTOSCROLL:
- case COMMAND_AUTOSCROLL:
- {
- nRet = HandleScrollCommand (*pCmdEvent, &maHorizontalScrollBar, &maVerticalScrollBar);
- break;
- }
- }
- }
-
- if( ! nRet )
- nRet = ::Window::Notify( rNEvt );
-
- return nRet;
-}
-
-
-
-
-::com::sun::star::uno::Reference<
- ::com::sun::star::accessibility::XAccessible> ScrollPanel::CreateAccessibleObject (
- const ::com::sun::star::uno::Reference<
- ::com::sun::star::accessibility::XAccessible>& )
-{
- return new ::accessibility::AccessibleScrollPanel (
- *this,
- "Scroll Panel",
- "Scroll Panel");
-}
-
-
-
-
-void ScrollPanel::MakeRectangleVisible (
- Rectangle& aRectangle,
- ::Window* pWindow)
-{
- if (maVerticalScrollBar.IsVisible() && aRectangle.GetWidth()>0 && aRectangle.GetHeight()>0)
- {
- const Rectangle aRelativeBox (pWindow->GetWindowExtentsRelative(&maScrollWindow));
-
- aRectangle.Move(
- -maScrollOffset.X() + aRelativeBox.Left(),
- -maScrollOffset.Y() + aRelativeBox.Top());
-
- const int nVisibleHeight (maVerticalScrollBar.GetVisibleSize());
- const int nVisibleTop (maVerticalScrollBar.GetThumbPos());
- if (aRectangle.Bottom() >= nVisibleTop+nVisibleHeight)
- maVerticalScrollBar.DoScroll(aRectangle.Bottom() - nVisibleHeight);
- else if (aRectangle.Top() < nVisibleTop)
- maVerticalScrollBar.DoScroll(aRectangle.Top());
- }
-}
-
-
-
-
-IMPL_LINK(ScrollPanel,WindowEventListener,VclSimpleEvent*,pEvent)
-{
- VclWindowEvent* pWindowEvent = dynamic_cast<VclWindowEvent*>(pEvent);
- if (pWindowEvent != NULL)
- {
- switch (pWindowEvent->GetId())
- {
- case VCLEVENT_WINDOW_KEYUP:
- case VCLEVENT_WINDOW_MOUSEBUTTONUP:
- {
- // Make the currently selected item visible.
- ValueSet* pControl = dynamic_cast<ValueSet*>(pWindowEvent->GetWindow());
- if (pControl != NULL)
- {
- // Get the bounding box of the currently selected item
- // and enlarge this so that the selection frame is
- // inside as well.
- Rectangle aBox (pControl->GetItemRect(pControl->GetSelectItemId()));
- aBox.Top()-=4;
- aBox.Bottom()+=4;
-
- MakeRectangleVisible(aBox, pControl);
- }
- }
- break;
-
- case VCLEVENT_WINDOW_MOUSEBUTTONDOWN:
- {
- // Make the item under the mouse visible. We need this case
- // for right clicks that open context menus. For these we
- // only get the mouse down event. The following mouse up
- // event is sent to the context menu.
- ValueSet* pControl = dynamic_cast<ValueSet*>(pWindowEvent->GetWindow());
- if (pControl != NULL)
- {
- // Get the bounding box of the item at the mouse
- // position and enlarge this so that the selection frame
- // is inside as well.
- MouseEvent* pMouseEvent
- = reinterpret_cast<MouseEvent*>(pWindowEvent->GetData());
- if (pMouseEvent != NULL)
- {
- Point aPosition (pMouseEvent->GetPosPixel());
- Rectangle aBox (pControl->GetItemRect(pControl->GetItemId(aPosition)));
- aBox.Top()-=4;
- aBox.Bottom()+=4;
-
- MakeRectangleVisible(aBox, pControl);
- }
- }
- }
- break;
-
-
- case VCLEVENT_WINDOW_GETFOCUS:
- {
- // Move title bars into the visible area when they get the
- // focus (::Window wise their enclosing TitledControl gets
- // the focus.)
- TitledControl* pTitledControl = dynamic_cast<TitledControl*>(pWindowEvent->GetWindow());
- if (pTitledControl!=NULL && pTitledControl->GetTitleBar()!=NULL)
- {
- ::Window* pTitleBarWindow = pTitledControl->GetTitleBar()->GetWindow();
- Rectangle aBox(pTitleBarWindow->GetPosPixel(),pTitleBarWindow->GetSizePixel());
- MakeRectangleVisible(
- aBox,
- pTitleBarWindow);
- }
- }
- break;
-
- case VCLEVENT_WINDOW_SHOW:
- case VCLEVENT_WINDOW_HIDE:
- case VCLEVENT_WINDOW_ACTIVATE:
- case VCLEVENT_WINDOW_RESIZE:
- // Rearrange the children of the scroll panel when one of
- // the children changes its size or visibility.
- RequestResize();
- break;
- }
- }
- return 0;
-}
-
-
-
-
-} } // end of namespace ::sd::toolpanel
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/toolpanel/SlideSorterCacheDisplay.cxx b/sd/source/ui/toolpanel/SlideSorterCacheDisplay.cxx
deleted file mode 100644
index 059ab35a87d8..000000000000
--- a/sd/source/ui/toolpanel/SlideSorterCacheDisplay.cxx
+++ /dev/null
@@ -1,363 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-
-#include "taskpane/SlideSorterCacheDisplay.hxx"
-
-#ifdef USE_SLIDE_SORTER_CACHE_DISPLAY
-
-#include "taskpane/ScrollPanel.hxx"
-#include "taskpane/TaskPaneControlFactory.hxx"
-
-#include <vcl/window.hxx>
-#include <vcl/lstbox.hxx>
-#include <vcl/button.hxx>
-
-namespace {
-
-static const Color maBackgroundColor (255,250,245);
-
-class PageCacheWindow : public ::Window
-{
-public:
- PageCacheWindow (
- ::Window* pParentWindow,
- ::sd::toolpanel::SlideSorterCacheDisplay* pDisplay)
- : ::Window(pParentWindow),
- mpDisplay(pDisplay)
- {
- SetBackground(Wallpaper(maBackgroundColor));
- }
-
- virtual void Paint (const Rectangle& rBoundingBox)
- { mpDisplay->Paint(rBoundingBox); ::Window::Paint(rBoundingBox); }
- virtual void Resize (void) { mpDisplay->Resize(); ::Window::Resize(); }
-
-private:
- ::sd::toolpanel::SlideSorterCacheDisplay* mpDisplay;
-};
-
-}
-
-
-
-namespace sd { namespace toolpanel {
-
-::std::map<const SdDrawDocument*, SlideSorterCacheDisplay*> SlideSorterCacheDisplay::maDisplays;
-
-SlideSorterCacheDisplay::SlideSorterCacheDisplay (const SdDrawDocument* pDocument)
- : TreeNode(NULL),
- mpWindow(NULL),
- mnPageCount(0),
- mnColumnCount(0),
- mnRowCount(0),
- maCellSize(0,0),
- mnHorizontalBorder(0),
- mnVerticalBorder(0)
-{
- SlideSorterCacheDisplay::AddInstance(pDocument,this);
-}
-
-
-
-
-SlideSorterCacheDisplay::~SlideSorterCacheDisplay (void)
-{
- if (mpWindow != NULL)
- delete mpWindow;
- SlideSorterCacheDisplay::RemoveInstance(this);
-}
-
-
-
-
-void SlideSorterCacheDisplay::SetParentWindow (::Window* pParentWindow)
-{
- mpWindow = new PageCacheWindow(pParentWindow, this);
-}
-
-
-
-
-void SlideSorterCacheDisplay::Paint (const Rectangle& rBoundingBox)
-{
- if (maCellSize.Width()>0 && maCellSize.Height()>0 && mpWindow!=NULL)
- {
- Color maSavedFillColor (mpWindow->GetFillColor());
- Color maSavedLineColor (mpWindow->GetLineColor());
- sal_Int32 nC0 = (rBoundingBox.Left() - mnHorizontalBorder) / maCellSize.Width();
- sal_Int32 nC1 = (rBoundingBox.Right() - mnHorizontalBorder) / maCellSize.Width();
- sal_Int32 nR0 = (rBoundingBox.Top() - mnVerticalBorder) / maCellSize.Height();
- sal_Int32 nR1 = (rBoundingBox.Bottom() - mnVerticalBorder) / maCellSize.Height();
- for (sal_Int32 nC=nC0; nC<=nC1; ++nC)
- for (sal_Int32 nR=nR0; nR<=nR1; ++nR)
- {
- sal_Int32 nPageIndex (nC + nR*mnColumnCount);
- if (nPageIndex < mnPageCount)
- {
- Rectangle aBox (GetPageBox(nPageIndex));
- if ( ! maPageDescriptors[nPageIndex].mbVisible)
- {
- mpWindow->SetLineColor();
- mpWindow->SetFillColor(maBackgroundColor);
- mpWindow->DrawRect(aBox);
-
- aBox.Left() += maCellSize.Width()/4;
- aBox.Right() -= maCellSize.Width()/4;
- aBox.Top() += maCellSize.Height()/4;
- aBox.Bottom() -= maCellSize.Height()/4;
- }
-
- switch (maPageDescriptors[nPageIndex].meStatus)
- {
- case NONE : mpWindow->SetFillColor (Color(95,255,128)); break;
- case RENDERING : mpWindow->SetFillColor (Color(236,125,128)); break;
- case IN_QUEUE_PRIORITY_0 : mpWindow->SetFillColor (Color(255,243,0)); break;
- case IN_QUEUE_PRIORITY_1 : mpWindow->SetFillColor (Color(255,199,0)); break;
- case IN_QUEUE_PRIORITY_2 : mpWindow->SetFillColor (Color(20,255,128)); break;
- default : mpWindow->SetFillColor (COL_BLACK); break;
- }
- mpWindow->SetLineColor(COL_BLACK);
- mpWindow->DrawRect(aBox);
-
- if ( ! maPageDescriptors[nPageIndex].mbUpToDate)
- mpWindow->DrawLine(aBox.TopLeft(), aBox.BottomRight());
- }
- }
- mpWindow->SetLineColor(maSavedLineColor);
- mpWindow->SetFillColor(maSavedFillColor);
- }
-}
-
-
-
-
-void SlideSorterCacheDisplay::Resize (void)
-{
- if (mpWindow != NULL)
- {
- double nW = mpWindow->GetSizePixel().Width();
- double nH = mpWindow->GetSizePixel().Height();
- if (nH > 0)
- {
- double nAspect = nW / nH;
- sal_Int32 nR = 1;
- sal_Int32 nC = 1;
- while (nR * nC < mnPageCount)
- {
- if (double(nC) / double(nR) > nAspect)
- ++nR;
- else
- ++nC;
- }
-
- mnRowCount = nR;
- mnColumnCount = nC;
- mnHorizontalGap = 2;
- mnVerticalGap = 2;
- maCellSize = Size(
- (int)((nW-(nC-1)*mnHorizontalGap) / nC),
- (int)((nH-(nR-1)*mnVerticalGap) / nR));
- mnHorizontalBorder = (int)(nW - nC*maCellSize.Width() - ((nC-1)*mnHorizontalGap))/2;
- mnVerticalBorder = (int)(nH - nR*maCellSize.Height() - ((nR-1)*mnVerticalGap))/2;
- }
- }
-}
-
-
-
-
-SlideSorterCacheDisplay* SlideSorterCacheDisplay::Instance (const SdDrawDocument* pDocument)
-{
- SlideSorterCacheDisplay* pDisplay = NULL;
- ::std::map<const SdDrawDocument*, SlideSorterCacheDisplay*>::iterator iDisplay;
- for (iDisplay=maDisplays.begin(); iDisplay!=maDisplays.end(); ++iDisplay)
- if (iDisplay->first == pDocument)
- pDisplay = iDisplay->second;
-
- if (pDisplay == NULL)
- {
- pDisplay = new SlideSorterCacheDisplay(pDocument);
- }
-
- return pDisplay;
-}
-
-
-
-
-void SlideSorterCacheDisplay::SetPageCount (sal_Int32 nPageCount)
-{
- mnPageCount = nPageCount;
- maPageDescriptors.resize(nPageCount);
- Resize();
- if (mpWindow != NULL)
- mpWindow->Invalidate();
-}
-
-
-
-
-void SlideSorterCacheDisplay::SetPageStatus (sal_Int32 nPageIndex, PageStatus eStatus)
-{
- ProvideSize(nPageIndex);
- maPageDescriptors[nPageIndex].meStatus = eStatus;
- PaintPage(nPageIndex);
-}
-
-
-
-
-void SlideSorterCacheDisplay::SetPageVisibility (sal_Int32 nPageIndex, bool bVisible)
-{
- ProvideSize(nPageIndex);
- maPageDescriptors[nPageIndex].mbVisible = bVisible;
- PaintPage(nPageIndex);
-}
-
-
-
-
-void SlideSorterCacheDisplay::SetUpToDate (sal_Int32 nPageIndex, bool bUpToDate)
-{
- ProvideSize(nPageIndex);
- maPageDescriptors[nPageIndex].mbUpToDate = bUpToDate;
- PaintPage(nPageIndex);
-}
-
-
-
-
-Rectangle SlideSorterCacheDisplay::GetPageBox (sal_Int32 nPageIndex)
-{
- sal_Int32 nRow = nPageIndex / mnColumnCount;
- sal_Int32 nColumn = nPageIndex % mnColumnCount;
- return Rectangle(
- Point(mnHorizontalBorder + nColumn * maCellSize.Width() + nColumn*mnHorizontalGap,
- mnVerticalBorder + nRow * maCellSize.Height() + nRow*mnVerticalGap),
- maCellSize);
-}
-
-
-
-
-void SlideSorterCacheDisplay::AddInstance (
- const SdDrawDocument* pDocument,
- SlideSorterCacheDisplay* pControl)
-{
- maDisplays[pDocument] = pControl;
-}
-
-
-
-
-void SlideSorterCacheDisplay::RemoveInstance (SlideSorterCacheDisplay* pControl)
-{
- ::std::map<const SdDrawDocument*, SlideSorterCacheDisplay*>::iterator iDisplay;
- for (iDisplay=maDisplays.begin(); iDisplay!=maDisplays.end(); ++iDisplay)
- if (iDisplay->second == pControl)
- {
- maDisplays.erase(iDisplay);
- break;
- }
-}
-
-
-
-
-void SlideSorterCacheDisplay::ProvideSize (sal_Int32 nPageIndex)
-{
- if (maPageDescriptors.size() <= (sal_uInt32)nPageIndex)
- maPageDescriptors.resize(nPageIndex+1);
- if (mnPageCount <= nPageIndex)
- mnPageCount = nPageIndex;
-}
-
-
-
-
-Size SlideSorterCacheDisplay::GetPreferredSize (void)
-{
- return Size(100,100);
-}
-
-
-
-
-sal_Int32 SlideSorterCacheDisplay::GetPreferredWidth (sal_Int32 nHeigh)
-{
- return GetPreferredSize().Width();
-}
-
-
-
-
-sal_Int32 SlideSorterCacheDisplay::GetPreferredHeight (sal_Int32 nWidth)
-{
- return GetPreferredSize().Height();
-}
-
-
-
-::Window* SlideSorterCacheDisplay::GetWindow (void)
-{
- return mpWindow;
-}
-
-
-
-
-bool SlideSorterCacheDisplay::IsResizable (void)
-{
- return true;
-}
-
-
-
-
-bool SlideSorterCacheDisplay::IsExpandable (void) const
-{
- return true;
-}
-
-
-
-
-bool SlideSorterCacheDisplay::IsExpanded (void) const
-{
- return true;
-}
-
-
-
-
-void SlideSorterCacheDisplay::PaintPage (sal_Int32 nPageIndex)
-{
- if (mpWindow != NULL)
- {
- Paint(GetPageBox(nPageIndex));
- }
-}
-
-
-} } // end of namespace ::sd::toolpanel
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/toolpanel/SubToolPanel.cxx b/sd/source/ui/toolpanel/SubToolPanel.cxx
deleted file mode 100644
index 58999e88721d..000000000000
--- a/sd/source/ui/toolpanel/SubToolPanel.cxx
+++ /dev/null
@@ -1,381 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-
-#include "taskpane/SubToolPanel.hxx"
-
-#include "TaskPaneFocusManager.hxx"
-#include "taskpane/TitleBar.hxx"
-#include "taskpane/TitledControl.hxx"
-#include "taskpane/ControlContainer.hxx"
-#include "AccessibleTreeNode.hxx"
-#include <vcl/decoview.hxx>
-#include <vcl/svapp.hxx>
-
-namespace sd { namespace toolpanel {
-
-
-SubToolPanel::SubToolPanel (
- Window& i_rParentWindow)
- : Control (&i_rParentWindow, WB_DIALOGCONTROL),
- TreeNode(NULL),
- maWindowFiller(this),
- mbIsRearrangePending(true),
- mbIsLayoutPending(true),
- mnChildrenWidth(0),
- mnVerticalBorder(0),
- mnVerticalGap(3),
- mnHorizontalBorder(2)
-{
- SetAccessibleName (OUString("Sub Task Panel"));
- mpControlContainer->SetMultiSelection (true);
-
- SetBorderStyle (WINDOW_BORDER_NORMAL);
- SetMapMode (MapMode(MAP_PIXEL));
-
- // To reduce flickering during repaints make the container windows
- // transparent and rely on their children to paint the whole area.
- SetBackground(Wallpaper());
- maWindowFiller.SetBackground(
- Application::GetSettings().GetStyleSettings().GetWindowColor());
-}
-
-
-
-
-SubToolPanel::~SubToolPanel (void)
-{
- sal_uInt32 nCount = mpControlContainer->GetControlCount();
- for (sal_uInt32 nIndex=0; nIndex<nCount; nIndex++)
- {
- TitledControl* pControl = static_cast<TitledControl*>(
- mpControlContainer->GetControl(nIndex));
- pControl->GetControl()->GetWindow()->RemoveEventListener(
- LINK(this,SubToolPanel,WindowEventListener));
- }
- mpControlContainer->DeleteChildren();
-}
-
-
-
-
-void SubToolPanel::Paint (const Rectangle& rRect)
-{
- if (mbIsRearrangePending)
- Rearrange();
- if (mbIsLayoutPending)
- LayoutChildren();
- ::Window::Paint (rRect);
-
- // Paint the outer border and the space between every two children.
- Color aOriginalLineColor (GetLineColor());
- Color aOriginalFillColor (GetFillColor());
-
- SetLineColor ();
- SetFillColor (GetSettings().GetStyleSettings().GetWindowColor());
-
- Size aSize (GetOutputSizePixel());
- // Paint left and right vertical border.
- Rectangle aVerticalArea (
- Point(0,0),
- Size(mnHorizontalBorder,aSize.Height()));
- DrawRect (aVerticalArea);
- aVerticalArea.Right() += mnHorizontalBorder + mnChildrenWidth - 1;
- aVerticalArea.Left() = aVerticalArea.Right() + mnHorizontalBorder;
- DrawRect (aVerticalArea);
-
- // Paint horizontal stripes.
- Rectangle aStripeArea (
- Point (mnHorizontalBorder,0),
- Size(mnChildrenWidth,0));
- StripeList::const_iterator iStripe;
- for (iStripe=maStripeList.begin(); iStripe!=maStripeList.end(); ++iStripe)
- {
- aStripeArea.Top() = iStripe->first;
- aStripeArea.Bottom() = iStripe->second;
- if (aStripeArea.Bottom() < 0)
- continue;
- if (aStripeArea.Top() >= aSize.Height())
- break;
- DrawRect (aStripeArea);
- }
-
- SetLineColor (aOriginalLineColor);
- SetFillColor (aOriginalFillColor);
-}
-
-
-
-
-void SubToolPanel::Resize (void)
-{
- ::Window::Resize();
- mbIsRearrangePending = true;
- mbIsLayoutPending = true;
-}
-
-
-
-
-void SubToolPanel::RequestResize (void)
-{
- mbIsRearrangePending = true;
- mbIsLayoutPending = true;
- Invalidate();
-}
-
-
-
-
-Size SubToolPanel::GetPreferredSize (void)
-{
- return GetRequiredSize();
-}
-
-
-
-
-sal_Int32 SubToolPanel::GetPreferredWidth (sal_Int32 )
-{
- return GetPreferredSize().Width();
-}
-
-
-
-
-sal_Int32 SubToolPanel::GetPreferredHeight (sal_Int32 )
-{
- return GetPreferredSize().Height();
-}
-
-
-
-
-bool SubToolPanel::IsResizable (void)
-{
- return true;
-}
-
-
-
-
-::Window* SubToolPanel::GetWindow (void)
-{
- return this;
-}
-
-
-
-
-sal_Int32 SubToolPanel::GetMinimumWidth (void)
-{
- return TreeNode::GetMinimumWidth();
-}
-
-
-
-
-void SubToolPanel::ExpandControl (
- TreeNode* pControl,
- bool bExpansionState)
-{
- // Toggle expand status.
- pControl->Expand (bExpansionState);
-
- Rearrange ();
- Invalidate ();
-}
-
-
-
-
-/** This control shows an expansion bar for every control and in a
- separate area below that expansion area it shows all controls each
- with its title bar. When there is not enough space then show a
- scroll bar in the control area.
-*/
-void SubToolPanel::Rearrange (void)
-{
- Size aRequiredSize (GetRequiredSize());
- if (aRequiredSize.Width()>0 && aRequiredSize.Height()>0)
- {
- Size aAvailableSize (GetOutputSizePixel());
-
- // Make the children at least as wide as the sub tool panel.
- if (aRequiredSize.Width() < aAvailableSize.Width())
- aRequiredSize.Width() = aAvailableSize.Width();
- mnChildrenWidth = -2*mnHorizontalBorder;
- mnChildrenWidth += aAvailableSize.Width();
-
- LayoutChildren();
-
- mbIsRearrangePending = false;
- }
-}
-
-
-
-
-Size SubToolPanel::GetRequiredSize (void)
-{
- // First determine the width of the children. This is the maximum of
- // the current window width and the individual minimum widths of the
- // children.
- int nChildrenWidth (GetSizePixel().Width());
- unsigned int nCount = mpControlContainer->GetControlCount();
- unsigned int nIndex;
- for (nIndex=0; nIndex<nCount; nIndex++)
- {
- TreeNode* pChild = mpControlContainer->GetControl (nIndex);
- int nMinimumWidth (pChild->GetMinimumWidth());
- if (nMinimumWidth > nChildrenWidth)
- nChildrenWidth = nMinimumWidth;
- }
-
- // Determine the accumulated width of all children when scaled to the
- // minimum width.
- nChildrenWidth -= 2*mnHorizontalBorder;
- Size aTotalSize (nChildrenWidth,
- 2*mnVerticalBorder + (nCount-1) * mnVerticalGap);
- for (nIndex=0; nIndex<nCount; nIndex++)
- {
- TreeNode* pChild = mpControlContainer->GetControl (nIndex);
- sal_Int32 nHeight = pChild->GetPreferredHeight(nChildrenWidth);
- aTotalSize.Height() += nHeight;
- }
-
- return aTotalSize;
-}
-
-
-
-
-sal_Int32 SubToolPanel::LayoutChildren (void)
-{
- // Determine vertical space that can be distributed to sizable children.
- unsigned int nCount (mpControlContainer->GetControlCount());
- unsigned int nResizableCount = 0;
- int nAvailableHeight = GetSizePixel().Height() - 2*mnVerticalBorder;
- unsigned int nIndex;
- for (nIndex=0; nIndex<nCount; nIndex++)
- {
- TreeNode* pChild = mpControlContainer->GetControl (nIndex);
- int nControlHeight = pChild->GetPreferredHeight(mnChildrenWidth);
- if (pChild->IsResizable())
- nResizableCount++;
- else
- nAvailableHeight -= nControlHeight;
- }
-
- maStripeList.clear();
-
- Point aPosition (0,0);
- aPosition.X() += mnHorizontalBorder;
- maStripeList.push_back( ::std::pair<int,int>(
- aPosition.Y(),
- aPosition.Y() + mnVerticalBorder - 1));
- aPosition.Y() += mnVerticalBorder;
-
- // Place the controls one over the other.
- for (nIndex=0; nIndex<nCount; nIndex++)
- {
- if (nIndex > 0)
- {
- maStripeList.push_back( ::std::pair<int,int>(
- aPosition.Y(),
- aPosition.Y() + mnVerticalGap - 1));
- aPosition.Y() += mnVerticalGap;
- }
- TreeNode* pChild = mpControlContainer->GetControl (nIndex);
- int nControlHeight = pChild->GetPreferredHeight(mnChildrenWidth);
- if (pChild->IsResizable())
- {
- nControlHeight = nAvailableHeight / nResizableCount;
- nResizableCount--;
- }
- nAvailableHeight -= nControlHeight;
- pChild->GetWindow()->SetPosSizePixel(
- aPosition,
- Size(mnChildrenWidth, nControlHeight));
- aPosition.Y() += nControlHeight;
- }
-
- // If the children do not cover their parent window completely
- // (regarding the height) we put a filler below that is responsible for
- // painting the remaining space.
- int nWindowHeight = GetSizePixel().Height();
- if (aPosition.Y() < nWindowHeight)
- {
- maWindowFiller.SetPosSizePixel (
- aPosition,
- Size(mnChildrenWidth, nWindowHeight-aPosition.Y()));
- maStripeList.push_back( ::std::pair<int,int>(
- aPosition.Y(),
- nWindowHeight-1));
- // maScrollWindowFiller.Show();
- aPosition.Y() = nWindowHeight;
- }
- else
- maWindowFiller.Hide();
-
- aPosition.Y() += mnVerticalBorder;
- mbIsLayoutPending = false;
-
- return aPosition.Y();
-}
-
-
-
-
-IMPL_LINK(SubToolPanel, WindowEventListener, VclSimpleEvent*, pEvent)
-{
- if (pEvent!=NULL && pEvent->ISA(VclWindowEvent))
- {
- VclWindowEvent* pWindowEvent = static_cast<VclWindowEvent*>(pEvent);
- switch (pWindowEvent->GetId())
- {
- case VCLEVENT_WINDOW_SHOW:
- case VCLEVENT_WINDOW_HIDE:
- case VCLEVENT_WINDOW_ACTIVATE:
- case VCLEVENT_WINDOW_RESIZE:
- RequestResize();
- break;
- }
- }
- return 0;
-}
-
-
-
-
-::com::sun::star::uno::Reference<
- ::com::sun::star::accessibility::XAccessible> SubToolPanel::CreateAccessibleObject (
- const ::com::sun::star::uno::Reference<
- ::com::sun::star::accessibility::XAccessible>& )
-{
- return new ::accessibility::AccessibleTreeNode (
- *this,
- "Sub Task Panel",
- "Sub Task Panel",
- ::com::sun::star::accessibility::AccessibleRole::PANEL);
-}
-
-} } // end of namespace ::sd::toolpanel
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/toolpanel/TaskPaneControlFactory.cxx b/sd/source/ui/toolpanel/TaskPaneControlFactory.cxx
deleted file mode 100644
index a3c135e1e677..000000000000
--- a/sd/source/ui/toolpanel/TaskPaneControlFactory.cxx
+++ /dev/null
@@ -1,49 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-
-#include "taskpane/TaskPaneControlFactory.hxx"
-
-#include <osl/diagnose.h>
-
-namespace sd { namespace toolpanel {
-
-ControlFactory::ControlFactory (void)
-{
-}
-
-
-
-
-ControlFactory::~ControlFactory (void)
-{
-}
-
-
-
-
-::std::auto_ptr<TreeNode> ControlFactory::CreateControl( ::Window& i_rParent )
-{
- TreeNode* pNewNode = InternalCreateControl( i_rParent );
- return ::std::auto_ptr<TreeNode>( pNewNode );
-}
-
-} } // end of namespace ::sd::toolpanel
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/toolpanel/TaskPaneFocusManager.cxx b/sd/source/ui/toolpanel/TaskPaneFocusManager.cxx
deleted file mode 100644
index df5fe4477b7a..000000000000
--- a/sd/source/ui/toolpanel/TaskPaneFocusManager.cxx
+++ /dev/null
@@ -1,316 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-
-#include "TaskPaneFocusManager.hxx"
-
-#include <vcl/window.hxx>
-#include <vcl/svapp.hxx>
-#include <vcl/event.hxx>
-#include <rtl/instance.hxx>
-#include <boost/unordered_map.hpp>
-
-namespace {
-
-class WindowHash
-{
-public:
- size_t operator()(const ::Window* argument) const
- { return reinterpret_cast<uintptr_t>(argument); }
-};
-
-class EventDescriptor
-{
-public:
- EventDescriptor (const KeyCode& rKey, ::Window* pWindow)
- : maKeyCode(rKey), mpTargetWindow(pWindow) {}
- KeyCode maKeyCode;
- ::Window* mpTargetWindow;
-};
-
-} // end of anonymous namespace
-
-
-
-
-namespace sd { namespace toolpanel {
-
-
-
-class FocusManager::LinkMap
- : public ::boost::unordered_multimap< ::Window*, EventDescriptor, WindowHash>
-{
-};
-
-struct FocusManagerCreator
-{
- FocusManager m_aFocusManager;
-};
-
-namespace
-{
- class theFocusManagerInstance : public rtl::Static< FocusManagerCreator, theFocusManagerInstance> {};
-}
-
-FocusManager& FocusManager::Instance (void)
-{
- return theFocusManagerInstance::get().m_aFocusManager;
-}
-
-
-
-
-FocusManager::FocusManager (void)
- : mpLinks(new LinkMap())
-{
-}
-
-
-
-
-FocusManager::~FocusManager (void)
-{
- Clear();
-}
-
-
-
-
-void FocusManager::Clear (void)
-{
- if (mpLinks.get() != NULL)
- {
- while ( ! mpLinks->empty())
- {
- ::Window* pWindow = mpLinks->begin()->first;
- if (pWindow == NULL)
- {
- mpLinks->erase(mpLinks->begin());
- }
- else
- {
- RemoveLinks(pWindow);
- }
- }
- }
-}
-
-
-
-
-void FocusManager::RegisterUpLink (::Window* pSource, ::Window* pTarget)
-{
- RegisterLink(pSource, pTarget, KEY_ESCAPE);
-}
-
-
-
-
-void FocusManager::RegisterDownLink (::Window* pSource, ::Window* pTarget)
-{
- RegisterLink(pSource, pTarget, KEY_RETURN);
-}
-
-
-
-
-void FocusManager::RegisterLink (
- ::Window* pSource,
- ::Window* pTarget,
- const KeyCode& rKey)
-{
- OSL_ASSERT(pSource!=NULL);
- OSL_ASSERT(pTarget!=NULL);
-
- if (pSource==NULL || pTarget==NULL)
- return;
-
- // Register this focus manager as event listener at the source window.
- if (mpLinks->equal_range(pSource).first == mpLinks->end())
- pSource->AddEventListener (LINK (this, FocusManager, WindowEventListener));
- mpLinks->insert(LinkMap::value_type(pSource, EventDescriptor(rKey,pTarget)));
-}
-
-
-
-
-void FocusManager::RemoveLinks (
- ::Window* pSourceWindow,
- ::Window* pTargetWindow)
-{
- OSL_ASSERT(pSourceWindow!=NULL);
- OSL_ASSERT(pTargetWindow!=NULL);
-
- if (pSourceWindow==NULL || pTargetWindow==NULL)
- {
- // This method was called with invalid arguments. To avoid
- // referencing windows that will soon be deleted we clear *all*
- // links as an emergency fallback.
- Clear();
- return;
- }
-
- ::std::pair<LinkMap::iterator,LinkMap::iterator> aCandidates;
- LinkMap::iterator iCandidate;
- bool bLoop (mpLinks->size() > 0);
- while (bLoop)
- {
- aCandidates = mpLinks->equal_range(pSourceWindow);
- if (aCandidates.first == mpLinks->end())
- {
- // No links for the source window found -> nothing more to do.
- bLoop = false;
- }
- else
- {
- // Set the loop control to false so that when no candidate for
- // deletion is found the loop is left.
- bLoop = false;
- for (iCandidate=aCandidates.first; iCandidate!=aCandidates.second; ++iCandidate)
- if (iCandidate->second.mpTargetWindow == pTargetWindow)
- {
- mpLinks->erase(iCandidate);
- // One link erased. The iterators have become invalid so
- // start the search for links to delete anew.
- bLoop = true;
- break;
- }
- }
- }
-
- RemoveUnusedEventListener(pSourceWindow);
-}
-
-
-
-
-void FocusManager::RemoveLinks (::Window* pWindow)
-{
- OSL_ASSERT(pWindow!=NULL);
-
- if (pWindow == NULL)
- {
- // This method was called with invalid arguments. To avoid
- // referencing windows that will soon be deleted we clear *all*
- // links as an emergency fallback.
- Clear();
- return;
- }
-
- // Make sure that we are not called back for the window.
- pWindow->RemoveEventListener (LINK (this, FocusManager, WindowEventListener));
-
- // Remove the links from the given window.
- mpLinks->erase(pWindow);
-
- // Remove links to the given window.
- bool bLinkRemoved;
- do
- {
- bLinkRemoved = false;
- LinkMap::iterator iLink;
- for (iLink=mpLinks->begin(); iLink!=mpLinks->end(); ++iLink)
- {
- if (iLink->second.mpTargetWindow == pWindow)
- {
- ::Window* const pSourceWindow(iLink->first);
- mpLinks->erase(iLink);
- RemoveUnusedEventListener(pSourceWindow);
- bLinkRemoved = true;
- break;
- }
- }
- }
- while (bLinkRemoved);
-}
-
-
-
-
-void FocusManager::RemoveUnusedEventListener (::Window* pWindow)
-{
- OSL_ASSERT(pWindow!=NULL);
-
- if (pWindow == NULL)
- return;
-
- // When there are no more links from the window to another window
- // then remove the event listener from the window.
- if (mpLinks->find(pWindow) == mpLinks->end())
- pWindow->RemoveEventListener (LINK (this, FocusManager, WindowEventListener));
-}
-
-
-
-
-bool FocusManager::TransferFocus (
- ::Window* pSourceWindow,
- const KeyCode& rKeyCode)
-{
- bool bSuccess (false);
-
- OSL_ASSERT(pSourceWindow!=NULL);
- if (pSourceWindow == NULL)
- return bSuccess;
-
- ::std::pair<LinkMap::iterator,LinkMap::iterator> aCandidates (
- mpLinks->equal_range(pSourceWindow));
- LinkMap::const_iterator iCandidate;
- for (iCandidate=aCandidates.first; iCandidate!=aCandidates.second; ++iCandidate)
- if (iCandidate->second.maKeyCode == rKeyCode)
- {
- OSL_ASSERT(iCandidate->second.mpTargetWindow != NULL);
- iCandidate->second.mpTargetWindow->GrabFocus();
- bSuccess = true;
- break;
- }
-
- return bSuccess;
-}
-
-
-
-
-IMPL_LINK(FocusManager, WindowEventListener, VclSimpleEvent*, pEvent)
-{
- if (pEvent!=NULL && pEvent->ISA(VclWindowEvent))
- {
- VclWindowEvent* pWindowEvent = static_cast<VclWindowEvent*>(pEvent);
- switch (pWindowEvent->GetId())
- {
- case VCLEVENT_WINDOW_KEYINPUT:
- {
- ::Window* pSource = pWindowEvent->GetWindow();
- KeyEvent* pKeyEvent = static_cast<KeyEvent*>(pWindowEvent->GetData());
- TransferFocus(pSource, pKeyEvent->GetKeyCode());
- }
- break;
-
- case VCLEVENT_OBJECT_DYING:
- RemoveLinks(pWindowEvent->GetWindow());
- break;
- }
- }
- return 1;
-}
-
-
-} } // end of namespace ::sd::toolpanel
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/toolpanel/TaskPaneFocusManager.hxx b/sd/source/ui/toolpanel/TaskPaneFocusManager.hxx
deleted file mode 100644
index 4ae747ebe468..000000000000
--- a/sd/source/ui/toolpanel/TaskPaneFocusManager.hxx
+++ /dev/null
@@ -1,130 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#ifndef SD_TOOLPANEL_FOCUS_MANAGER_HXX
-#define SD_TOOLPANEL_FOCUS_MANAGER_HXX
-
-#include <tools/link.hxx>
-
-#include <memory>
-
-class KeyCode;
-class VclSimpleEvent;
-class Window;
-
-namespace sd { namespace toolpanel {
-
-/** On certain key presses the focus is moved from one window to another.
- For this to work every window that wants its focus managed has to
- register or be registered and tell where to put the focus on what key
- press.
-*/
-class FocusManager
-{
-public:
- /** Return an instance of the focus manager.
- */
- static FocusManager& Instance (void);
-
- /** Register a link from one window to another so that any time the
- specified key is pressed while the source window is focused, the
- focus is transferred to the target window.
- @param pSource
- The window from which the focus will be transferred.
- @param pTarget
- The window to which the focus will be transferred.
- @param rKey
- The key for which the focus is transferred from the source
- window to the target window.
- */
- void RegisterLink (
- ::Window* pSource,
- ::Window* pTarget,
- const KeyCode& rKey);
-
- /** Register a link that will move the focus from the source window to
- the target window when the source window is focused and KEY_ESCAPE
- is pressed.
- @param pSource
- The window from which the focus will be transferred.
- @param pTarget
- The window to which the focus will be transferred.
- */
- void RegisterUpLink (::Window* pSource, ::Window* pTarget);
-
- /** Register a link that will move the focus from the source window to
- the target window when the source window is focused and KEY_RETURN
- is pressed.
- @param pSource
- The window from which the focus will be transferred.
- @param pTarget
- The window to which the focus will be transferred.
- */
- void RegisterDownLink (::Window* pSource, ::Window* pTarget);
-
- /** Remove all links from the source window to the target window. When
- there are links from the target window to the source window then
- these are not touced.
- */
- void RemoveLinks (
- ::Window* pSource,
- ::Window* pTarget);
-
- /** Let the focus manager transfer the focus from the specified source
- window to a target window that is determined according the the
- registered links and the given key code.
- When there is no rule for this combination of source window and key
- code then the focus stays where it is.
- */
- bool TransferFocus (::Window* pSource, const KeyCode& rCode);
-
-private:
- friend struct FocusManagerCreator;
-
- class LinkMap;
- ::std::auto_ptr<LinkMap> mpLinks;
-
- FocusManager (void);
- ~FocusManager (void);
-
- /** Clear the list of focus transfer links. This removes all window
- listeners.
- */
- void Clear (void);
-
- /** Remove all links from or to the given window.
- */
- void RemoveLinks (::Window* pWindow);
-
- /** Unregister as event listener from the given window when there are no
- links from this window anymore.
- */
- void RemoveUnusedEventListener (::Window* pWindow);
-
- /** Listen for key events and on KEY_RETURN go down and on
- KEY_ESCAPE go up.
- */
- DECL_LINK(WindowEventListener, VclSimpleEvent*);
-};
-
-} } // end of namespace ::sd::toolpanel
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/toolpanel/TaskPaneShellManager.cxx b/sd/source/ui/toolpanel/TaskPaneShellManager.cxx
deleted file mode 100644
index 2b249bed3e7f..000000000000
--- a/sd/source/ui/toolpanel/TaskPaneShellManager.cxx
+++ /dev/null
@@ -1,175 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-
-#include "TaskPaneShellManager.hxx"
-
-#include "ViewShellManager.hxx"
-#include <tools/diagnose_ex.h>
-#include <vcl/window.hxx>
-
-#include <algorithm>
-
-namespace sd { namespace toolpanel {
-
-TaskPaneShellManager::TaskPaneShellManager (
- const ::boost::shared_ptr<ViewShellManager>& rpViewShellManager,
- const ViewShell& rViewShell)
- : mpViewShellManager(rpViewShellManager),
- mrViewShell(rViewShell),
- maSubShells()
-{
-}
-
-
-
-
-TaskPaneShellManager::~TaskPaneShellManager (void)
-{
- while ( ! maSubShells.empty())
- RemoveSubShell(maSubShells.begin()->second.mpShell);
-}
-
-
-
-
-SfxShell* TaskPaneShellManager::CreateShell( ShellId nId, ::Window* , FrameView* )
-{
- SubShells::const_iterator iShell (maSubShells.find(nId));
- if (iShell != maSubShells.end())
- return iShell->second.mpShell;
- else
- return NULL;
-}
-
-
-
-
-void TaskPaneShellManager::ReleaseShell (SfxShell* )
-{
- // Nothing to do.
-}
-
-void TaskPaneShellManager::AddSubShell (
- ShellId nId,
- SfxShell* pShell,
- ::Window* pWindow)
-{
- if (pShell != NULL)
- {
- maSubShells[nId] = ShellDescriptor(pShell,pWindow);
- if (pWindow != NULL)
- {
- pWindow->AddEventListener(LINK(this,TaskPaneShellManager,WindowCallback));
- if (pWindow->IsReallyVisible())
- mpViewShellManager->ActivateSubShell(mrViewShell, nId);
- }
- else
- mpViewShellManager->ActivateSubShell(mrViewShell, nId);
- }
-}
-
-
-
-
-void TaskPaneShellManager::RemoveSubShell (const ShellId i_nShellId)
-{
- SubShells::iterator pos = maSubShells.find( i_nShellId );
- ENSURE_OR_RETURN_VOID( pos != maSubShells.end(), "no shell for this ID" );
- if ( pos->second.mpWindow != NULL )
- {
- pos->second.mpWindow->RemoveEventListener( LINK( this, TaskPaneShellManager, WindowCallback ) );
- }
- mpViewShellManager->DeactivateSubShell( mrViewShell, pos->first );
- maSubShells.erase( pos );
-}
-
-
-
-
-void TaskPaneShellManager::RemoveSubShell (const SfxShell* pShell)
-{
- if (pShell != NULL)
- {
- SubShells::iterator iShell;
- for (iShell=maSubShells.begin(); iShell!=maSubShells.end(); ++iShell)
- if (iShell->second.mpShell == pShell)
- {
- if (iShell->second.mpWindow != NULL)
- iShell->second.mpWindow->RemoveEventListener(
- LINK(this,TaskPaneShellManager,WindowCallback));
- mpViewShellManager->DeactivateSubShell(mrViewShell,iShell->first);
- maSubShells.erase(iShell);
- break;
- }
- }
-}
-
-
-
-
-void TaskPaneShellManager::MoveToTop (SfxShell* pShell)
-{
- SubShells::const_iterator iShell;
- for (iShell=maSubShells.begin(); iShell!=maSubShells.end(); ++iShell)
- if (iShell->second.mpShell == pShell)
- {
- ViewShellManager::UpdateLock aLocker (mpViewShellManager);
- mpViewShellManager->MoveSubShellToTop(mrViewShell,iShell->first);
- mpViewShellManager->MoveToTop(mrViewShell);
- break;
- }
-}
-
-
-
-
-IMPL_LINK(TaskPaneShellManager, WindowCallback, VclWindowEvent*, pEvent)
-{
- if (pEvent != NULL)
- {
- SubShells::const_iterator iShell;
- ::Window* pWindow = pEvent->GetWindow();
- for (iShell=maSubShells.begin(); iShell!=maSubShells.end(); ++iShell)
- if (iShell->second.mpWindow == pWindow)
- break;
- if (iShell != maSubShells.end())
- switch (pEvent->GetId())
- {
- case VCLEVENT_WINDOW_SHOW:
- mpViewShellManager->ActivateSubShell(mrViewShell,iShell->first);
- break;
-
- case VCLEVENT_WINDOW_HIDE:
- // Do not activate the sub shell. This leads to
- // problems with shapes currently being in text edit
- // mode: Deactivating the shell leads to leaving the
- // text editing mode.
- // mpViewShellManager->DeactivateSubShell(mrViewShell,iShell->first);
- break;
- }
- }
-
- return 0;
-}
-
-
-} } // end of namespace ::sd::toolpanel
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/toolpanel/TaskPaneShellManager.hxx b/sd/source/ui/toolpanel/TaskPaneShellManager.hxx
deleted file mode 100644
index 967503ac6736..000000000000
--- a/sd/source/ui/toolpanel/TaskPaneShellManager.hxx
+++ /dev/null
@@ -1,116 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#ifndef SD_TOOLPANEL_TASK_PANE_SHELL_MANAGER_HXX
-#define SD_TOOLPANEL_TASK_PANE_SHELL_MANAGER_HXX
-
-#include "ShellFactory.hxx"
-#include "ViewShellManager.hxx"
-#include <tools/link.hxx>
-#include <map>
-
-class FrameView;
-class SfxShell;
-class VclWindowEvent;
-class Window;
-
-namespace sd {
-class ViewShell;
-}
-
-namespace sd { namespace toolpanel {
-
-/** The TaskPaneShellManager implements the ViewShellManager::ShellFactory
- interface. However, it does not create or delete shells. It only
- gives the ViewShellManager access to the sub shells of the
- ToolPanelViewShell. Life time control of the sub shells is managed by
- the sub shells themselves.
-*/
-class TaskPaneShellManager
- : public ShellFactory<SfxShell>
-{
-public:
- /** Create a shell manager that manages the stacked shells for the given
- view shell. It works together with the given view shell manager.
- */
- TaskPaneShellManager (
- const ::boost::shared_ptr<ViewShellManager>& rpViewShellManager,
- const ViewShell& rViewShell);
- ~TaskPaneShellManager (void);
-
- /** Return the requested sub shell.
- @param nId
- The id of the requested sub shell.
- @return
- When there is no sub shell currently registered under the given
- id then NULL is returned.
- */
- virtual SfxShell* CreateShell (
- ShellId nId,
- ::Window* pParentWindow,
- FrameView* pFrameView = NULL);
-
- virtual void ReleaseShell (SfxShell* pShell);
-
- /** Add a sub shell to the set of sub shells managed by the
- TaskPaneShellManager. Only shells added by this method are returned
- by CreateShell().
- */
- void AddSubShell (ShellId nId, SfxShell* pShell, ::Window* pWindow);
-
- /** Remove the given shell from the set of sub shells managed by the
- TaskPaneShellManager. Following calls to CreateShell() will return
- NULL when this shell is requested.
- */
- void RemoveSubShell (const SfxShell* pShell);
- /** removes the shell given by its ID from the set of sub shells managed by the
- TaskPaneShellManager. Subsequent calls to CreateShell() will return
- NULL when this shell is requested.
- */
- void RemoveSubShell (const ShellId i_nShellId);
-
- /** Move the given sub-shell to the top of the local shell stack.
- Furthermore move the view shell whose sub-shells this class manages
- to the top of the global shell stack.
- */
- void MoveToTop (SfxShell* pShell);
-
- DECL_LINK(WindowCallback,VclWindowEvent*);
-
-private:
- ::boost::shared_ptr<ViewShellManager> mpViewShellManager;
-
- /// The view shell whose sub-shells this class manages.
- const ViewShell& mrViewShell;
-
- class ShellDescriptor { public:
- SfxShell* mpShell;
- ::Window* mpWindow;
- ShellDescriptor(void) : mpShell(NULL),mpWindow(NULL){}
- ShellDescriptor(SfxShell*pShell,::Window*pWindow) : mpShell(pShell),mpWindow(pWindow){}
- };
- typedef ::std::map<ShellId,ShellDescriptor> SubShells;
- SubShells maSubShells;
-};
-
-} } // end of namespace ::sd::toolpanel
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/toolpanel/TaskPaneTreeNode.cxx b/sd/source/ui/toolpanel/TaskPaneTreeNode.cxx
deleted file mode 100644
index dd7485095531..000000000000
--- a/sd/source/ui/toolpanel/TaskPaneTreeNode.cxx
+++ /dev/null
@@ -1,284 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-
-#include "taskpane/TaskPaneTreeNode.hxx"
-
-#include "taskpane/ControlContainer.hxx"
-#include "taskpane/TitledControl.hxx"
-
-#include <vector>
-#include <algorithm>
-
-namespace sd { namespace toolpanel {
-
-TreeNode::TreeNode( TreeNode* pParent)
-: mpControlContainer (new ControlContainer(this))
-, mpParent (pParent)
-, maStateChangeListeners()
-{
-}
-
-
-
-
-TreeNode::~TreeNode (void)
-{
-}
-
-
-
-
-void TreeNode::SetParentNode (TreeNode* pNewParent)
-{
- mpParent = pNewParent;
- GetWindow()->SetParent (pNewParent->GetWindow());
-}
-
-
-
-
-TreeNode* TreeNode::GetParentNode (void)
-{
- return mpParent;
-}
-
-
-
-
-::Window* TreeNode::GetWindow (void)
-{
- return NULL;
-}
-
-
-
-
-const ::Window* TreeNode::GetConstWindow (void) const
-{
- return const_cast<TreeNode*>(this)->GetWindow();
-}
-
-
-
-
-sal_Int32 TreeNode::GetMinimumWidth (void)
-{
- sal_Int32 nTotalMinimumWidth = 0;
- unsigned int nCount = mpControlContainer->GetControlCount();
- for (unsigned int nIndex=0; nIndex<nCount; nIndex++)
- {
- TreeNode* pChild = mpControlContainer->GetControl (nIndex);
- sal_Int32 nMinimumWidth = pChild->GetMinimumWidth ();
- if (nMinimumWidth > nTotalMinimumWidth)
- nTotalMinimumWidth = nMinimumWidth;
- }
-
- return nTotalMinimumWidth;
-}
-
-
-
-
-bool TreeNode::IsResizable (void)
-{
- return false;
-}
-
-
-
-
-void TreeNode::RequestResize (void)
-{
- if (mpParent != NULL)
- mpParent->RequestResize();
-}
-
-
-
-
-ControlContainer& TreeNode::GetControlContainer (void)
-{
- return *mpControlContainer.get();
-}
-
-
-
-
-bool TreeNode::Expand (bool bExpansionState)
-{
- bool bExpansionStateChanged (false);
-
- if (IsExpandable() && IsExpanded()!=bExpansionState)
- {
- if (bExpansionState)
- GetWindow()->Show();
- else
- GetWindow()->Hide();
- bExpansionStateChanged = true;
-
- FireStateChangeEvent (EID_EXPANSION_STATE_CHANGED);
- }
-
- return bExpansionStateChanged;
-}
-
-
-
-
-bool TreeNode::IsExpanded (void) const
-{
- if (GetConstWindow()!=NULL)
- return GetConstWindow()->IsVisible();
- else
- return false;
-}
-
-
-
-
-bool TreeNode::IsExpandable (void) const
-{
- return GetConstWindow()!=NULL;
-}
-
-
-
-
-void TreeNode::Show (bool bExpansionState)
-{
- if (GetWindow() != NULL)
- {
- bool bWasShowing (IsShowing());
- GetWindow()->Show (bExpansionState);
- if (bWasShowing != bExpansionState)
- FireStateChangeEvent (EID_SHOWING_STATE_CHANGED);
- }
-}
-
-
-
-
-bool TreeNode::IsShowing (void) const
-{
- const ::Window* pWindow = const_cast<TreeNode*>(this)->GetWindow();
- if (pWindow != NULL)
- return pWindow->IsVisible();
- else
- return false;
-}
-
-
-
-
-TaskPaneShellManager* TreeNode::GetShellManager (void)
-{
- if (mpParent != NULL)
- return mpParent->GetShellManager();
- else
- return NULL;
-}
-
-
-
-
-::com::sun::star::uno::Reference<
- ::com::sun::star::accessibility::XAccessible> TreeNode::GetAccessibleObject (void)
-{
- ::com::sun::star::uno::Reference<
- ::com::sun::star::accessibility::XAccessible> xAccessible;
- ::Window* pWindow = GetWindow();
- if (pWindow != NULL)
- {
- xAccessible = pWindow->GetAccessible(sal_False);
- if ( ! xAccessible.is())
- {
- ::com::sun::star::uno::Reference<
- ::com::sun::star::accessibility::XAccessible> xParent;
- if (pWindow->GetAccessibleParentWindow()!=NULL)
- xParent = pWindow->GetAccessibleParentWindow()->GetAccessible();
- xAccessible = CreateAccessibleObject(xParent);
- pWindow->SetAccessible(xAccessible);
- }
- }
- return xAccessible;
-}
-
-
-
-
-::com::sun::star::uno::Reference<
- ::com::sun::star::accessibility::XAccessible> TreeNode::CreateAccessibleObject (
- const ::com::sun::star::uno::Reference<
- ::com::sun::star::accessibility::XAccessible>& )
-{
- if (GetWindow() != NULL)
- return GetWindow()->CreateAccessible();
- else
- return NULL;
-}
-
-
-
-
-void TreeNode::AddStateChangeListener (const Link& rListener)
-{
- if (::std::find (
- maStateChangeListeners.begin(),
- maStateChangeListeners.end(),
- rListener) == maStateChangeListeners.end())
- {
- maStateChangeListeners.push_back(rListener);
- }
-}
-
-
-
-
-void TreeNode::FireStateChangeEvent (
- TreeNodeStateChangeEventId eEventId,
- TreeNode* pChild) const
-{
- TreeNodeStateChangeEvent aEvent (*this, eEventId, pChild);
- StateChangeListenerContainer aContainerCopy(maStateChangeListeners);
- StateChangeListenerContainer::iterator aLink (aContainerCopy.begin());
- StateChangeListenerContainer::iterator aEnd (aContainerCopy.end());
- while (aLink!=aEnd)
- {
- aLink->Call (&aEvent);
- ++aLink;
- }
-}
-
-
-
-TreeNodeStateChangeEvent::TreeNodeStateChangeEvent (
- const TreeNode& rNode,
- TreeNodeStateChangeEventId eEventId,
- TreeNode* pChild)
- : mrSource(rNode),
- meEventId(eEventId),
- mpChild(pChild)
-{
-}
-
-
-} } // end of namespace ::sd::toolpanel
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/toolpanel/TitleBar.cxx b/sd/source/ui/toolpanel/TitleBar.cxx
deleted file mode 100644
index ca33f7c21d00..000000000000
--- a/sd/source/ui/toolpanel/TitleBar.cxx
+++ /dev/null
@@ -1,559 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-
-#include "taskpane/TitleBar.hxx"
-
-#include "ControlContainerDescriptor.hxx"
-#include "tools/IconCache.hxx"
-#include "AccessibleTreeNode.hxx"
-#include <vcl/decoview.hxx>
-#include <vcl/window.hxx>
-#include <vcl/virdev.hxx>
-#include <osl/mutex.hxx>
-#include <vcl/svapp.hxx>
-#include "sdresid.hxx"
-#include <vcl/bitmap.hxx>
-#include <vcl/lineinfo.hxx>
-#include <vcl/bitmapex.hxx>
-#include <tools/color.hxx>
-#include <svx/xdash.hxx>
-#include <svl/itemset.hxx>
-#include <svx/xlndsit.hxx>
-#include <svx/xlineit0.hxx>
-#include <svx/svdobj.hxx>
-#include <svx/svdpool.hxx>
-#include <svtools/colorcfg.hxx>
-#include <svx/xlnclit.hxx>
-#include <svx/xfillit0.hxx>
-#include "res_bmp.hrc"
-
-
-namespace sd { namespace toolpanel {
-
-const int TitleBar::snIndentationWidth = 16;
-
-TitleBar::TitleBar ( ::Window* pParent, const OUString& rsTitle, TitleBarType eType, bool bIsExpandable)
-: ::Window (pParent, WB_TABSTOP)
-, TreeNode(this)
-, meType(eType)
-, msTitle(rsTitle)
-, mbExpanded(false)
-, mbFocused(false)
-, mpDevice(new VirtualDevice (*this))
-, mbIsExpandable (bIsExpandable)
-{
- EnableMapMode (sal_False);
-
- SetBackground (Wallpaper());
-
- // Change the mouse pointer shape so that it acts as a mouse over effect.
- switch (meType)
- {
- case TBT_SUB_CONTROL_HEADLINE:
- if (mbIsExpandable)
- SetPointer (POINTER_REFHAND);
- break;
- }
-}
-
-
-
-
-TitleBar::~TitleBar (void)
-{
-}
-
-
-
-
-Size TitleBar::GetPreferredSize (void)
-{
- int nWidth = GetOutputSizePixel().Width();
- Rectangle aTitleBarBox (
- CalculateTitleBarBox(
- CalculateTextBoundingBox(nWidth, true),
- nWidth));
-
- return aTitleBarBox.GetSize();
-}
-
-
-
-
-sal_Int32 TitleBar::GetPreferredWidth (sal_Int32 )
-{
- Rectangle aTitleBarBox (
- CalculateTitleBarBox(
- CalculateTextBoundingBox(0, true),
- 0));
- return aTitleBarBox.GetWidth();
-}
-
-
-
-
-sal_Int32 TitleBar::GetPreferredHeight (sal_Int32 nWidth)
-{
- Rectangle aTitleBarBox (
- CalculateTitleBarBox(
- CalculateTextBoundingBox(nWidth, true),
- nWidth));
-
- return aTitleBarBox.GetHeight();
-}
-
-
-
-
-bool TitleBar::IsResizable (void)
-{
- return true;
-}
-
-
-
-
-::Window* TitleBar::GetWindow (void)
-{
- return this;
-}
-
-
-
-
-sal_Int32 TitleBar::GetMinimumWidth (void)
-{
- return 20;
-}
-
-
-
-
-void TitleBar::Paint (const Rectangle& rBoundingBox)
-{
- mpDevice->SetMapMode(GetMapMode());
- mpDevice->SetOutputSize (GetOutputSizePixel());
- mpDevice->SetSettings(GetSettings());
- mpDevice->SetDrawMode(GetDrawMode());
-
- switch (meType)
- {
- case TBT_SUB_CONTROL_HEADLINE:
- PaintSubPanelHeadLineBar ();
- break;
- }
-
- DrawOutDev (
- Point(0,0),
- GetOutputSizePixel(),
- Point(0,0),
- GetOutputSizePixel(),
- *mpDevice);
-
- ::Window::Paint (rBoundingBox);
-}
-
-
-
-
-bool TitleBar::Expand (bool bFlag)
-{
- bool bExpansionStateChanged (bFlag!=IsExpanded());
- mbExpanded = bFlag;
- Invalidate ();
- return bExpansionStateChanged;
-}
-
-
-
-
-bool TitleBar::IsExpanded (void) const
-{
- return mbExpanded;
-}
-
-
-void TitleBar::SetEnabledState(bool bFlag)
-{
- if(bFlag)
- Enable();
- else
- Disable();
- Invalidate ();
-}
-
-
-
-
-void TitleBar::GetFocus()
-{
- mbFocused = true;
- Invalidate();
-}
-
-
-
-
-void TitleBar::LoseFocus()
-{
- mbFocused = false;
- Invalidate();
-}
-
-
-
-
-bool TitleBar::HasExpansionIndicator (void) const
-{
- bool bHasExpansionIndicator (false);
- if (mbIsExpandable)
- {
- switch (meType)
- {
- case TBT_SUB_CONTROL_HEADLINE:
- bHasExpansionIndicator = true;
- break;
- }
- }
- return bHasExpansionIndicator;
-}
-
-
-
-
-Image TitleBar::GetExpansionIndicator (void) const
-{
- Image aIndicator;
- if (mbIsExpandable)
- {
- sal_uInt16 nResourceId = 0;
- switch (meType)
- {
- case TBT_SUB_CONTROL_HEADLINE:
- if (mbExpanded)
- nResourceId = BMP_COLLAPSE;
- else
- nResourceId = BMP_EXPAND;
-
- aIndicator = IconCache::Instance().GetIcon(nResourceId);
- break;
- }
- }
-
- return aIndicator;
-}
-
-
-
-
-void TitleBar::PaintSubPanelHeadLineBar (void)
-{
- int nWidth (GetOutputSizePixel().Width());
- Rectangle aTextBox (CalculateTextBoundingBox (nWidth, true));
-
- Rectangle aTitleBarBox (CalculateTitleBarBox(aTextBox, nWidth));
- int nVerticalOffset = -aTitleBarBox.Top();
- aTitleBarBox.Top() += nVerticalOffset;
- aTitleBarBox.Bottom() += nVerticalOffset;
- aTextBox.Top() += nVerticalOffset;
- aTextBox.Bottom() += nVerticalOffset;
-
- PaintBackground (aTitleBarBox);
- Rectangle aFocusBox (PaintExpansionIndicator (aTextBox));
- PaintText (aTextBox);
-
- aFocusBox.Union (aTextBox);
- aFocusBox.Left() -= 2;
- aFocusBox.Right() += 1;
- PaintFocusIndicator (aFocusBox);
-}
-
-
-
-
-void TitleBar::PaintFocusIndicator (const Rectangle& rTextBox)
-{
- if (mbFocused)
- {
- Rectangle aTextPixelBox (mpDevice->LogicToPixel (rTextBox));
- mpDevice->EnableMapMode (sal_False);
- Rectangle aBox (rTextBox);
- aBox.Top() -= 1;
- aBox.Bottom() += 1;
-
- mpDevice->SetFillColor ();
-
- mpDevice->DrawRect (aTextPixelBox);
-
- LineInfo aDottedStyle (LINE_DASH);
- aDottedStyle.SetDashCount (0);
- aDottedStyle.SetDotCount (1);
- aDottedStyle.SetDotLen (1);
- aDottedStyle.SetDistance (1);
-
- mpDevice->SetLineColor (COL_BLACK);
- mpDevice->DrawPolyLine (Polygon(aTextPixelBox), aDottedStyle);
- mpDevice->EnableMapMode (sal_False);
- }
- else
- HideFocus ();
-}
-
-
-
-
-Rectangle TitleBar::PaintExpansionIndicator (const Rectangle& rTextBox)
-{
- Rectangle aExpansionIndicatorArea;
-
- if (HasExpansionIndicator())
- {
- Image aImage = GetExpansionIndicator();
- int nHeight (aImage.GetSizePixel().Height());
- if (nHeight > 0)
- {
- Point aPosition (
- 0,
- rTextBox.Top() + (GetTextHeight() - nHeight) / 2);
- if (meType == TBT_SUB_CONTROL_HEADLINE)
- aPosition.X() += 3;
- mpDevice->DrawImage (aPosition, aImage);
-
- aExpansionIndicatorArea = Rectangle (
- aPosition, aImage.GetSizePixel());
- }
- }
-
- return aExpansionIndicatorArea;
-}
-
-
-
-
-void TitleBar::PaintText (const Rectangle& rTextBox)
-{
- mpDevice->DrawText (rTextBox, msTitle, GetTextStyle());
-}
-
-
-
-
-sal_uInt16 TitleBar::GetTextStyle (void)
-{
- if(IsEnabled())
- {
- return TEXT_DRAW_LEFT
- | TEXT_DRAW_TOP
- | TEXT_DRAW_MULTILINE
- | TEXT_DRAW_WORDBREAK;
- }
- else
- {
- return TEXT_DRAW_DISABLE;
- }
-}
-
-
-
-void TitleBar::PaintBackground (const Rectangle& rTitleBarBox)
-{
- // Fill a slightly rounded rectangle.
- switch (meType)
- {
- case TBT_SUB_CONTROL_HEADLINE:
- {
- Color aColor (GetSettings().GetStyleSettings().GetDialogColor());
- if (mbExpanded)
- {
- // Make the color a little bit darker.
- aColor.SetRed(sal_uInt8(((sal_uInt16)aColor.GetRed()) * 8 / 10));
- aColor.SetGreen(sal_uInt8(((sal_uInt16)aColor.GetGreen()) * 8 / 10));
- aColor.SetBlue(sal_uInt8(((sal_uInt16)aColor.GetBlue()) * 8 / 10));
- }
-
- mpDevice->SetFillColor (aColor);
- mpDevice->SetLineColor ();
- mpDevice->DrawRect (rTitleBarBox);
-
- // Erase the four corner pixels to make the rectangle appear
- // rounded.
- mpDevice->SetLineColor (
- GetSettings().GetStyleSettings().GetWindowColor());
- mpDevice->DrawPixel (
- rTitleBarBox.TopLeft());
- mpDevice->DrawPixel (
- Point(rTitleBarBox.Right(), rTitleBarBox.Top()));
- mpDevice->DrawPixel (
- Point(rTitleBarBox.Left(), rTitleBarBox.Bottom()));
- mpDevice->DrawPixel (
- Point(rTitleBarBox.Right(), rTitleBarBox.Bottom()));
- }
- break;
- }
-}
-
-
-
-
-Rectangle TitleBar::CalculateTextBoundingBox (
- int nAvailableWidth,
- bool bEmphasizeExpanded)
-{
- // Show the title of expanded controls in bold font.
- const Font& rOriginalFont (GetFont());
- Font aFont (rOriginalFont);
- if (bEmphasizeExpanded && mbExpanded)
- aFont.SetWeight (WEIGHT_BOLD);
- else
- aFont.SetWeight (WEIGHT_NORMAL);
- mpDevice->SetFont (aFont);
-
- // Use the natural width of the text when no width is given.
- if (nAvailableWidth == 0)
- nAvailableWidth = GetTextWidth (msTitle);
-
- Rectangle aTextBox (
- Point(0,0),
- Size (nAvailableWidth,
- GetSettings().GetStyleSettings().GetTitleHeight()));
- aTextBox.Top() += (aTextBox.GetHeight() - GetTextHeight()) / 2;
- if (HasExpansionIndicator())
- aTextBox.Left() += snIndentationWidth;
- else
- aTextBox.Left() += 3;
- aTextBox.Right() -= 1;
-
- aTextBox = mpDevice->GetTextRect (aTextBox, msTitle, GetTextStyle());
-
- return aTextBox;
-}
-
-
-
-
-Rectangle TitleBar::CalculateTitleBarBox (
- const Rectangle& rTextBox,
- int nWidth)
-{
- Rectangle aTitleBarBox (rTextBox);
-
- switch (meType)
- {
- case TBT_SUB_CONTROL_HEADLINE:
- aTitleBarBox.Top() -= 3;
- aTitleBarBox.Bottom() += 3;
- break;
-
- }
- aTitleBarBox.Left() = 0;
- if (aTitleBarBox.GetWidth() < nWidth)
- aTitleBarBox.Right() = nWidth-1;
-
- return aTitleBarBox;
-}
-
-
-
-
-void TitleBar::MouseMove (const MouseEvent& )
-{
-}
-
-
-
-
-void TitleBar::MouseButtonDown (const MouseEvent& )
-{
- // Do not forward to parent window so that the mouse button handler of
- // the docking window is not invoked.
-}
-
-
-
-
-void TitleBar::MouseButtonUp (const MouseEvent& )
-{
- // Do not forward to parent window so that the mouse button handler of
- // the docking window is not invoked.
-}
-
-
-
-
-void TitleBar::DataChanged (const DataChangedEvent& rEvent)
-{
- ::Window::DataChanged (rEvent);
-
- switch (rEvent.GetType())
- {
- case DATACHANGED_SETTINGS:
- if ((rEvent.GetFlags() & SETTINGS_STYLE) == 0)
- break;
- SetSettings(Application::GetSettings());
- mpDevice.reset(new VirtualDevice (*this));
-
- // fall through.
-
- case DATACHANGED_FONTS:
- case DATACHANGED_FONTSUBSTITUTION:
- {
- const StyleSettings& rStyleSettings (GetSettings().GetStyleSettings());
-
- // Font.
- Font aFont = rStyleSettings.GetAppFont();
- if (IsControlFont())
- aFont.Merge(GetControlFont());
- SetZoomedPointFont(aFont);
-
- // Color.
- Color aColor;
- if (IsControlForeground())
- aColor = GetControlForeground();
- else
- aColor = rStyleSettings.GetButtonTextColor();
- SetTextColor(aColor);
- SetTextFillColor();
-
- Resize();
- Invalidate();
- }
- break;
- }
-}
-
-
-
-
-::com::sun::star::uno::Reference<
- ::com::sun::star::accessibility::XAccessible > TitleBar::CreateAccessibleObject (
- const ::com::sun::star::uno::Reference<
- ::com::sun::star::accessibility::XAccessible>& )
-{
- return new ::accessibility::AccessibleTreeNode(
- *this,
- GetTitle(),
- GetTitle(),
- ::com::sun::star::accessibility::AccessibleRole::LABEL);
-}
-
-
-} } // end of namespace ::sd::toolpanel
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/toolpanel/TitledControl.cxx b/sd/source/ui/toolpanel/TitledControl.cxx
deleted file mode 100644
index 7e6fafd658cc..000000000000
--- a/sd/source/ui/toolpanel/TitledControl.cxx
+++ /dev/null
@@ -1,419 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-
-#include "taskpane/TitledControl.hxx"
-
-#include "AccessibleTreeNode.hxx"
-#include "taskpane/ControlContainer.hxx"
-#include "TaskPaneFocusManager.hxx"
-#include "taskpane/TaskPaneControlFactory.hxx"
-#include <vcl/ctrl.hxx>
-#include <vcl/svapp.hxx>
-
-
-namespace sd { namespace toolpanel {
-
-
-TitledControl::TitledControl (
- TreeNode* pParent,
- ::std::auto_ptr<TreeNode> pControl,
- const OUString& rTitle,
- const ClickHandler& rClickHandler,
- TitleBar::TitleBarType eType)
- : ::Window (pParent->GetWindow(), WB_TABSTOP),
- TreeNode(pParent),
- msTitle(rTitle),
- mbVisible(true),
- mpUserData(NULL),
- mpClickHandler(new ClickHandler(rClickHandler))
-{
- mpControlContainer->AddControl (::std::auto_ptr<TreeNode> (
- new TitleBar (this, rTitle, eType, pControl->IsExpandable())));
- pControl->SetParentNode (this);
- mpControlContainer->AddControl (pControl);
-
- FocusManager::Instance().RegisterDownLink( GetTitleBar()->GetWindow(), GetControl()->GetWindow() );
- FocusManager::Instance().RegisterUpLink( GetControl()->GetWindow(), GetTitleBar()->GetWindow() );
-
- SetBackground (Wallpaper());
-
- GetTitleBar()->GetWindow()->Show ();
- GetTitleBar()->GetWindow()->AddEventListener (
- LINK(this,TitledControl,WindowEventListener));
-
- UpdateStates ();
-}
-
-
-
-
-TitledControl::~TitledControl (void)
-{
- GetTitleBar()->GetWindow()->RemoveEventListener (
- LINK(this,TitledControl,WindowEventListener));
-}
-
-
-
-
-Size TitledControl::GetPreferredSize (void)
-{
- Size aPreferredSize;
- if (GetControl() != NULL)
- {
- aPreferredSize = GetControl()->GetPreferredSize();
- if ( ! IsExpanded())
- aPreferredSize.Height() = 0;
- }
- else
- aPreferredSize = Size (GetSizePixel().Width(), 0);
- if (aPreferredSize.Width() == 0)
- aPreferredSize.Width() = 300;
- aPreferredSize.Height() += GetTitleBar()->GetPreferredHeight(
- aPreferredSize.Width());
-
- return aPreferredSize;
-}
-
-
-
-
-sal_Int32 TitledControl::GetPreferredWidth (sal_Int32 nHeight)
-{
- int nPreferredWidth = 0;
- if (GetControl() != NULL)
- nPreferredWidth = GetControl()->GetPreferredWidth(
- nHeight - GetTitleBar()->GetWindow()->GetSizePixel().Height());
- else
- nPreferredWidth = GetSizePixel().Width();
- if (nPreferredWidth == 0)
- nPreferredWidth = 300;
-
- return nPreferredWidth;
-}
-
-
-
-
-sal_Int32 TitledControl::GetPreferredHeight (sal_Int32 nWidth)
-{
- int nPreferredHeight = 0;
- if (IsExpanded() && GetControl()!=NULL)
- nPreferredHeight = GetControl()->GetPreferredHeight(nWidth);
- nPreferredHeight += GetTitleBar()->GetPreferredHeight(nWidth);
-
- return nPreferredHeight;
-}
-
-
-
-
-bool TitledControl::IsResizable (void)
-{
- return IsExpanded()
- && GetControl()->IsResizable();
-}
-
-
-
-
-::Window* TitledControl::GetWindow (void)
-{
- return this;
-}
-
-
-
-
-void TitledControl::Resize (void)
-{
- Size aWindowSize (GetOutputSizePixel());
-
- int nTitleBarHeight
- = GetTitleBar()->GetPreferredHeight(aWindowSize.Width());
- GetTitleBar()->GetWindow()->SetPosSizePixel (
- Point (0,0),
- Size (aWindowSize.Width(), nTitleBarHeight));
-
-
- TreeNode* pControl = GetControl();
- if (pControl != NULL
- && pControl->GetWindow() != NULL
- && pControl->GetWindow()->IsVisible())
- {
- pControl->GetWindow()->SetPosSizePixel (
- Point (0,nTitleBarHeight),
- Size (aWindowSize.Width(), aWindowSize.Height()-nTitleBarHeight));
- }
-}
-
-
-
-
-void TitledControl::GetFocus (void)
-{
- ::Window::GetFocus();
- if (GetTitleBar() != NULL)
- GetTitleBar()->GrabFocus();
-}
-
-
-
-
-void TitledControl::KeyInput (const KeyEvent& rEvent)
-{
- KeyCode nCode = rEvent.GetKeyCode();
- if (nCode == KEY_SPACE)
- {
- // Toggle the expansion state of the control (when toggling is
- // supported.) The focus remains on this control.
- GetParentNode()->GetControlContainer().SetExpansionState (
- this,
- ControlContainer::ES_TOGGLE);
- }
- else if (nCode == KEY_RETURN)
- {
- // Return, also called enter, enters the control and puts the
- // focus to the first child. If the control is not yet
- // expanded then do that first.
- GetParentNode()->GetControlContainer().SetExpansionState (
- this,
- ControlContainer::ES_EXPAND);
-
- if ( ! FocusManager::Instance().TransferFocus(this,nCode))
- {
- // When already expanded then put focus on first child.
- TreeNode* pControl = GetControl();
- if (pControl!=NULL && IsExpanded())
- if (pControl->GetWindow() != NULL)
- pControl->GetWindow()->GrabFocus();
- }
- }
- else if (nCode == KEY_ESCAPE)
- {
- if ( ! FocusManager::Instance().TransferFocus(this,nCode))
- // Put focus to parent.
- GetParent()->GrabFocus();
- }
- else
- Window::KeyInput (rEvent);
-}
-
-
-
-
-const OUString& TitledControl::GetTitle (void) const
-{
- return msTitle;
-}
-
-
-
-
-bool TitledControl::Expand (bool bExpanded)
-{
- bool bExpansionStateChanged (false);
-
- if (IsExpandable() && IsEnabled())
- {
- if (GetTitleBar()->IsExpanded() != bExpanded)
- bExpansionStateChanged |= GetTitleBar()->Expand (bExpanded);
- // Get the control. Use the bExpanded parameter as argument to
- // indicate that a control is created via its factory only when it
- // is to be expanded. When it is collapsed this is not necessary.
- TreeNode* pControl = GetControl();
- if (pControl != NULL
- && GetControl()->IsExpanded() != bExpanded)
- {
- bExpansionStateChanged |= pControl->Expand (bExpanded);
- }
- if (bExpansionStateChanged)
- UpdateStates();
- }
-
- return bExpansionStateChanged;
-}
-
-
-
-
-bool TitledControl::IsExpandable (void) const
-{
- const TreeNode* pControl = GetConstControl();
- if (pControl != NULL)
- return pControl->IsExpandable();
- else
- // When a control factory is given but the control has not yet been
- // created we assume that the control is expandable.
- return true;
-}
-
-
-
-
-bool TitledControl::IsExpanded (void) const
-{
- const TreeNode* pControl = GetConstControl();
- if (pControl != NULL)
- return pControl->IsExpanded();
- else
- return false;
-}
-
-void TitledControl::SetEnabledState(bool bFlag)
-{
- if (!bFlag)
- {
- GetParentNode()->GetControlContainer().SetExpansionState (
- this,
- ControlContainer::ES_COLLAPSE);
- Disable();
- }
- else
- {
- Enable();
- }
-
- GetTitleBar()->SetEnabledState(bFlag);
-}
-
-
-
-bool TitledControl::IsShowing (void) const
-{
- return mbVisible;
-}
-
-
-
-
-void TitledControl::Show (bool bVisible)
-{
- if (mbVisible != bVisible)
- {
- mbVisible = bVisible;
- UpdateStates ();
- }
-}
-
-
-
-
-void TitledControl::UpdateStates (void)
-{
- if (mbVisible)
- GetWindow()->Show();
- else
- GetWindow()->Hide();
-
- TreeNode* pControl = GetControl();
- if (pControl!=NULL && pControl->GetWindow() != NULL)
- {
- if (IsVisible() && IsExpanded())
- pControl->GetWindow()->Show();
- else
- pControl->GetWindow()->Hide();
- }
-}
-
-
-
-
-IMPL_LINK(TitledControl, WindowEventListener,
- VclSimpleEvent*, pEvent)
-{
- if (pEvent!=NULL && pEvent->ISA(VclWindowEvent))
- {
- VclWindowEvent* pWindowEvent = static_cast<VclWindowEvent*>(pEvent);
- switch (pWindowEvent->GetId())
- {
- case VCLEVENT_WINDOW_MOUSEBUTTONUP:
- if (IsEnabled())
- (*mpClickHandler)(*this);
- break;
- }
- }
- return 0;
-}
-
-
-
-
-TreeNode* TitledControl::GetControl (void)
-{
- return mpControlContainer->GetControl(1);
-}
-
-
-
-
-const TreeNode* TitledControl::GetConstControl () const
-{
- return const_cast<TitledControl*>(this)->GetControl();
-}
-
-
-
-
-TitleBar* TitledControl::GetTitleBar (void)
-{
- return static_cast<TitleBar*>(mpControlContainer->GetControl(0));
-}
-
-
-
-
-::com::sun::star::uno::Reference<
- ::com::sun::star::accessibility::XAccessible> TitledControl::CreateAccessibleObject (
- const ::com::sun::star::uno::Reference<
- ::com::sun::star::accessibility::XAccessible>& )
-{
- return new ::accessibility::AccessibleTreeNode(
- *this,
- GetTitle(),
- GetTitle(),
- ::com::sun::star::accessibility::AccessibleRole::LIST_ITEM);
-}
-
-
-
-
-//===== TitledControlStandardClickHandler =====================================
-
-TitledControlStandardClickHandler::TitledControlStandardClickHandler (
- ControlContainer& rControlContainer,
- ControlContainer::ExpansionState eExpansionState)
- : mrControlContainer(rControlContainer),
- meExpansionState(eExpansionState)
-{
-}
-
-
-
-
-void TitledControlStandardClickHandler::operator () (TitledControl& rTitledControl)
-{
- // Toggle expansion.
- mrControlContainer.SetExpansionState (&rTitledControl, meExpansionState);
-}
-
-} } // end of namespace ::sd::toolpanel
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/toolpanel/ToolPanel.cxx b/sd/source/ui/toolpanel/ToolPanel.cxx
deleted file mode 100644
index c89d64847faf..000000000000
--- a/sd/source/ui/toolpanel/ToolPanel.cxx
+++ /dev/null
@@ -1,105 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-
-#include "ToolPanel.hxx"
-#include "MethodGuard.hxx"
-#include <taskpane/TaskPaneTreeNode.hxx>
-
-#include <com/sun/star/lang/DisposedException.hpp>
-
-#include <vcl/window.hxx>
-
-//......................................................................................................................
-namespace sd { namespace toolpanel
-{
-//......................................................................................................................
-
- using ::com::sun::star::uno::Reference;
- using ::com::sun::star::uno::XInterface;
- using ::com::sun::star::uno::UNO_QUERY;
- using ::com::sun::star::uno::UNO_QUERY_THROW;
- using ::com::sun::star::uno::UNO_SET_THROW;
- using ::com::sun::star::uno::Exception;
- using ::com::sun::star::uno::RuntimeException;
- using ::com::sun::star::uno::Any;
- using ::com::sun::star::uno::makeAny;
- using ::com::sun::star::uno::Sequence;
- using ::com::sun::star::uno::Type;
- using ::com::sun::star::lang::DisposedException;
- using ::com::sun::star::awt::XWindow;
- using ::com::sun::star::accessibility::XAccessible;
-
- typedef MethodGuard< ToolPanel > ToolPanelGuard;
-
- //==================================================================================================================
- //= ToolPanel
- //==================================================================================================================
- //------------------------------------------------------------------------------------------------------------------
- SAL_WNODEPRECATED_DECLARATIONS_PUSH
- ToolPanel::ToolPanel( ::std::auto_ptr< TreeNode >& i_rControl )
- :ToolPanel_Base( m_aMutex )
- ,m_pControl( i_rControl )
- {
- }
- SAL_WNODEPRECATED_DECLARATIONS_POP
-
- //------------------------------------------------------------------------------------------------------------------
- ToolPanel::~ToolPanel()
- {
- }
-
- //------------------------------------------------------------------------------------------------------------------
- void ToolPanel::checkDisposed()
- {
- if ( m_pControl.get() == NULL )
- throw DisposedException( OUString(), *this );
- }
-
- //------------------------------------------------------------------------------------------------------------------
- Reference< XWindow > SAL_CALL ToolPanel::getWindow() throw (RuntimeException)
- {
- ToolPanelGuard aGuard( *this );
- return Reference< XWindow >( m_pControl->GetWindow()->GetComponentInterface(), UNO_QUERY_THROW );
- }
-
- //------------------------------------------------------------------------------------------------------------------
- Reference< XAccessible > SAL_CALL ToolPanel::createAccessible( const Reference< XAccessible >& i_rParentAccessible ) throw (RuntimeException)
- {
- ToolPanelGuard aGuard( *this );
- Reference< XAccessible > xAccessible( m_pControl->GetWindow()->GetAccessible( sal_False ) );
- if ( !xAccessible.is() )
- {
- xAccessible.set( m_pControl->CreateAccessibleObject( i_rParentAccessible ) );
- m_pControl->GetWindow()->SetAccessible( xAccessible );
- }
- return xAccessible;
- }
-
- //------------------------------------------------------------------------------------------------------------------
- void SAL_CALL ToolPanel::disposing()
- {
- m_pControl.reset();
- }
-
-//......................................................................................................................
-} } // namespace sd::toolpanel
-//......................................................................................................................
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/toolpanel/ToolPanel.hxx b/sd/source/ui/toolpanel/ToolPanel.hxx
deleted file mode 100644
index 1ec20dcb192e..000000000000
--- a/sd/source/ui/toolpanel/ToolPanel.hxx
+++ /dev/null
@@ -1,73 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#ifndef SD_TOOLPANEL_HXX
-#define SD_TOOLPANEL_HXX
-
-#include <com/sun/star/ui/XToolPanel.hpp>
-
-#include <cppuhelper/basemutex.hxx>
-#include <cppuhelper/compbase1.hxx>
-
-#include <memory>
-
-//......................................................................................................................
-namespace sd { namespace toolpanel
-{
-//......................................................................................................................
-
- class TreeNode;
-
- //==================================================================================================================
- //= ToolPanel
- //==================================================================================================================
- typedef ::cppu::WeakComponentImplHelper1 < ::com::sun::star::ui::XToolPanel
- > ToolPanel_Base;
- class ToolPanel :public ::cppu::BaseMutex
- ,public ToolPanel_Base
- {
- public:
- ToolPanel(
- ::std::auto_ptr< TreeNode >& i_rControl
- );
-
- // XToolPanel
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > SAL_CALL getWindow() throw (::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL createAccessible( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& ParentAccessible ) throw (::com::sun::star::uno::RuntimeException);
-
- // OComponentHelper
- virtual void SAL_CALL disposing();
-
- ::osl::Mutex& getMutex() { return m_aMutex; }
- void checkDisposed();
-
- protected:
- ~ToolPanel();
-
- private:
- ::std::auto_ptr< TreeNode > m_pControl;
- };
-
-//......................................................................................................................
-} } // namespace sd::toolpanel
-//......................................................................................................................
-
-#endif // SD_TOOLPANEL_HXX
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/toolpanel/ToolPanelFactory.cxx b/sd/source/ui/toolpanel/ToolPanelFactory.cxx
deleted file mode 100644
index e1c63e250e09..000000000000
--- a/sd/source/ui/toolpanel/ToolPanelFactory.cxx
+++ /dev/null
@@ -1,246 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-
-#include "taskpane/ToolPanelViewShell.hxx"
-#include "framework/FrameworkHelper.hxx"
-#include "PaneChildWindows.hxx"
-#include "ViewShellBase.hxx"
-#include "app.hrc"
-
-#include <com/sun/star/ui/XUIElementFactory.hpp>
-#include <com/sun/star/lang/XServiceInfo.hpp>
-#include <com/sun/star/lang/XInitialization.hpp>
-#include <com/sun/star/uno/XComponentContext.hpp>
-#include <com/sun/star/frame/XFrame.hpp>
-#include <com/sun/star/awt/XWindow.hpp>
-
-#include <sfx2/frame.hxx>
-#include <vcl/svapp.hxx>
-#include <osl/mutex.hxx>
-#include <sfx2/viewfrm.hxx>
-#include <cppuhelper/implbase3.hxx>
-#include <comphelper/namedvaluecollection.hxx>
-#include <toolkit/helper/vclunohelper.hxx>
-
-//......................................................................................................................
-namespace sd { namespace toolpanel
-{
-//......................................................................................................................
-
- using ::com::sun::star::uno::Reference;
- using ::com::sun::star::uno::XInterface;
- using ::com::sun::star::uno::UNO_QUERY;
- using ::com::sun::star::uno::UNO_QUERY_THROW;
- using ::com::sun::star::uno::UNO_SET_THROW;
- using ::com::sun::star::uno::Exception;
- using ::com::sun::star::uno::RuntimeException;
- using ::com::sun::star::uno::Any;
- using ::com::sun::star::uno::makeAny;
- using ::com::sun::star::uno::Sequence;
- using ::com::sun::star::uno::Type;
- using ::com::sun::star::uno::XComponentContext;
- using ::com::sun::star::ui::XUIElementFactory;
- using ::com::sun::star::ui::XUIElement;
- using ::com::sun::star::beans::PropertyValue;
- using ::com::sun::star::container::NoSuchElementException;
- using ::com::sun::star::lang::IllegalArgumentException;
- using ::com::sun::star::lang::XServiceInfo;
- using ::com::sun::star::lang::XInitialization;
- using ::com::sun::star::frame::XFrame;
- using ::com::sun::star::awt::XWindow;
-
- //==================================================================================================================
- //= ToolPanelFactory
- //==================================================================================================================
- typedef ::cppu::WeakImplHelper3 < XUIElementFactory
- , XServiceInfo
- , XInitialization
- > ToolPanelFactory_Base;
- class ToolPanelFactory : public ToolPanelFactory_Base
- {
- public:
- ToolPanelFactory( const Reference< XComponentContext >& i_rContext );
-
- // XUIElementFactory
- virtual Reference< XUIElement > SAL_CALL createUIElement( const OUString& ResourceURL, const Sequence< PropertyValue >& Args ) throw (NoSuchElementException, IllegalArgumentException, RuntimeException);
-
- // XServiceInfo
- virtual OUString SAL_CALL getImplementationName( ) throw (RuntimeException);
- virtual ::sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) throw (RuntimeException);
- virtual Sequence< OUString > SAL_CALL getSupportedServiceNames( ) throw (RuntimeException);
-
- // XInitialization
- virtual void SAL_CALL initialize( const Sequence< Any >& aArguments ) throw (Exception, RuntimeException);
-
- protected:
- virtual ~ToolPanelFactory();
-
- private:
- const Reference< XComponentContext > m_xContext;
- };
-
- //------------------------------------------------------------------------------------------------------------------
- Reference< XInterface > SAL_CALL ToolPanelFactory_createInstance( const Reference< XComponentContext >& i_rContext )
- {
- return static_cast< cppu::OWeakObject * >(
- new ToolPanelFactory( i_rContext ) );
- }
-
- //------------------------------------------------------------------------------------------------------------------
- OUString ToolPanelFactory_getImplementationName() throw(RuntimeException)
- {
- return OUString( "com.sun.star.comp.drawing.ToolPanelFactory" ) ;
- }
-
- //------------------------------------------------------------------------------------------------------------------
- Sequence< OUString > SAL_CALL ToolPanelFactory_getSupportedServiceNames (void)
- throw (RuntimeException)
- {
- const OUString sServiceName( "com.sun.star.drawing.DefaultToolPanelFactory" );
- return Sequence< OUString >( &sServiceName, 1 );
- }
-
- //------------------------------------------------------------------------------------------------------------------
- ToolPanelFactory::ToolPanelFactory( const Reference< XComponentContext >& i_rContext )
- :m_xContext( i_rContext )
- {
- }
-
- //------------------------------------------------------------------------------------------------------------------
- ToolPanelFactory::~ToolPanelFactory()
- {
- }
-
- //------------------------------------------------------------------------------------------------------------------
- Reference< XUIElement > SAL_CALL ToolPanelFactory::createUIElement( const OUString& i_rResourceURL, const Sequence< PropertyValue >& i_rArgs ) throw (NoSuchElementException, IllegalArgumentException, RuntimeException)
- {
- SolarMutexGuard aSolarGuard;
-
- const PanelId ePanelId( toolpanel::GetStandardPanelId( i_rResourceURL ) );
- if ( ePanelId == PID_UNKNOWN )
- throw NoSuchElementException( i_rResourceURL, *this );
-
- const ::comphelper::NamedValueCollection aArgs( i_rArgs );
- const Reference< XFrame > xDocFrame( aArgs.getOrDefault( "Frame", Reference< XFrame >() ) );
- const Reference< XWindow > xParentWindow( aArgs.getOrDefault( "ParentWindow", Reference< XWindow >() ) );
- if ( !xDocFrame.is() || !xParentWindow.is() )
- throw IllegalArgumentException(
- "For creating a standard tool panel, a Frame and a Parent window are needed." ,
- *this,
- 2
- );
-
- // look up the Sfx(View)Frame for the given XFrame
- SfxViewFrame* pViewFrame = NULL;
- for ( SfxFrame* pFrame = SfxFrame::GetFirst();
- pFrame != NULL;
- pFrame = SfxFrame::GetNext( *pFrame )
- )
- {
- if ( pFrame->GetFrameInterface() == xDocFrame )
- {
- pViewFrame = pFrame->GetCurrentViewFrame();
- break;
- }
- }
-
- if ( !pViewFrame || !pViewFrame->HasChildWindow( SID_TASKPANE ) )
- throw IllegalArgumentException(
- "Illegal frame." ,
- *this,
- 2
- );
-
- // retrieve the task pane
- ToolPanelChildWindow* pToolPanelWindow( dynamic_cast< ToolPanelChildWindow* >( pViewFrame->GetChildWindow( SID_TASKPANE ) ) );
- if ( !pToolPanelWindow )
- throw IllegalArgumentException(
- "No Impress document, or no Impress Task Pane." ,
- *this,
- 2
- );
-
- // retrieve the ViewShellBase, and the view shell of the task pane
- ViewShellBase* pViewShellBase = dynamic_cast< ViewShellBase* >( pViewFrame->GetViewShell() );
- ::boost::shared_ptr< framework::FrameworkHelper > pFrameworkHelper;
- if ( pViewShellBase )
- pFrameworkHelper = framework::FrameworkHelper::Instance( *pViewShellBase );
- ::boost::shared_ptr< ViewShell > pViewShell;
- if ( pFrameworkHelper.get() )
- pViewShell = pFrameworkHelper->GetViewShell( framework::FrameworkHelper::msRightPaneURL );
- ToolPanelViewShell* pToolPanelShell = dynamic_cast< ToolPanelViewShell* >( pViewShell.get() );
-
- if ( !pToolPanelShell )
- throw IllegalArgumentException(
- "Wrong document type." ,
- *this,
- 2
- );
-
- ::Window* pParentWindow = VCLUnoHelper::GetWindow( xParentWindow );
- if ( !pParentWindow || !pToolPanelShell->IsPanelAnchorWindow( *pParentWindow ) )
- throw IllegalArgumentException(
- "Unsupported parent window." ,
- *this,
- 2
- );
-
- return pToolPanelShell->CreatePanelUIElement( xDocFrame, i_rResourceURL );
- }
-
- //------------------------------------------------------------------------------------------------------------------
- OUString SAL_CALL ToolPanelFactory::getImplementationName( ) throw (RuntimeException)
- {
- return ToolPanelFactory_getImplementationName();
- }
-
- //------------------------------------------------------------------------------------------------------------------
- ::sal_Bool SAL_CALL ToolPanelFactory::supportsService( const OUString& i_rServiceName ) throw (RuntimeException)
- {
- const Sequence< OUString > aSupported( getSupportedServiceNames() );
- for ( const OUString* pSupported = aSupported.getConstArray();
- pSupported != aSupported.getConstArray() + aSupported.getLength();
- ++pSupported
- )
- if ( *pSupported == i_rServiceName )
- return sal_True;
-
- return sal_False;
- }
-
- //------------------------------------------------------------------------------------------------------------------
- Sequence< OUString > SAL_CALL ToolPanelFactory::getSupportedServiceNames( ) throw (RuntimeException)
- {
- return ToolPanelFactory_getSupportedServiceNames();
- }
-
- //------------------------------------------------------------------------------------------------------------------
- void SAL_CALL ToolPanelFactory::initialize( const Sequence< Any >& i_rArguments ) throw (Exception, RuntimeException)
- {
- ::comphelper::NamedValueCollection aArgs( i_rArguments );
- (void)aArgs;
- // TODO
- }
-
-//......................................................................................................................
-} } // namespace sd::toolpanel
-//......................................................................................................................
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/toolpanel/ToolPanelUIElement.cxx b/sd/source/ui/toolpanel/ToolPanelUIElement.cxx
deleted file mode 100644
index 284bd44ef61f..000000000000
--- a/sd/source/ui/toolpanel/ToolPanelUIElement.cxx
+++ /dev/null
@@ -1,125 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-
-#include "ToolPanelUIElement.hxx"
-#include "MethodGuard.hxx"
-
-#include <com/sun/star/ui/UIElementType.hpp>
-#include <com/sun/star/lang/XComponent.hpp>
-
-#include <tools/diagnose_ex.h>
-
-//......................................................................................................................
-namespace sd { namespace toolpanel
-{
-//......................................................................................................................
-
- using ::com::sun::star::uno::Reference;
- using ::com::sun::star::uno::XInterface;
- using ::com::sun::star::uno::UNO_QUERY;
- using ::com::sun::star::uno::UNO_QUERY_THROW;
- using ::com::sun::star::uno::UNO_SET_THROW;
- using ::com::sun::star::uno::Exception;
- using ::com::sun::star::uno::RuntimeException;
- using ::com::sun::star::uno::Any;
- using ::com::sun::star::uno::makeAny;
- using ::com::sun::star::uno::Sequence;
- using ::com::sun::star::uno::Type;
- using ::com::sun::star::frame::XFrame;
- using ::com::sun::star::lang::XComponent;
- using ::com::sun::star::ui::XToolPanel;
- using ::com::sun::star::lang::DisposedException;
-
- namespace UIElementType = ::com::sun::star::ui::UIElementType;
-
- typedef MethodGuard< ToolPanelUIElement > UIElementMethodGuard;
-
- //==================================================================================================================
- //= ToolPanelUIElement
- //==================================================================================================================
- //------------------------------------------------------------------------------------------------------------------
- ToolPanelUIElement::ToolPanelUIElement( const Reference< XFrame >& i_rFrame, const OUString& i_rResourceURL,
- const Reference< XToolPanel >& i_rToolPanel )
- :ToolPanelUIElement_Base( m_aMutex )
- ,m_xFrame( i_rFrame )
- ,m_sResourceURL( i_rResourceURL )
- ,m_xToolPanel( i_rToolPanel )
- {
- }
-
- //------------------------------------------------------------------------------------------------------------------
- ToolPanelUIElement::~ToolPanelUIElement()
- {
- }
-
- //------------------------------------------------------------------------------------------------------------------
- void ToolPanelUIElement::checkDisposed()
- {
- if ( !m_xToolPanel.is() )
- throw DisposedException( OUString(), *this );
- }
-
- //------------------------------------------------------------------------------------------------------------------
- Reference< XFrame > SAL_CALL ToolPanelUIElement::getFrame() throw (RuntimeException)
- {
- UIElementMethodGuard aGuard( *this );
- return m_xFrame;
- }
-
- //------------------------------------------------------------------------------------------------------------------
- OUString SAL_CALL ToolPanelUIElement::getResourceURL() throw (RuntimeException)
- {
- UIElementMethodGuard aGuard( *this );
- return m_sResourceURL;
- }
-
- //------------------------------------------------------------------------------------------------------------------
- ::sal_Int16 SAL_CALL ToolPanelUIElement::getType() throw (RuntimeException)
- {
- UIElementMethodGuard aGuard( *this );
- return UIElementType::TOOLPANEL;
- }
-
- //------------------------------------------------------------------------------------------------------------------
- Reference< XInterface > SAL_CALL ToolPanelUIElement::getRealInterface( ) throw (RuntimeException)
- {
- UIElementMethodGuard aGuard( *this );
- return m_xToolPanel.get();
- }
-
- //------------------------------------------------------------------------------------------------------------------
- void SAL_CALL ToolPanelUIElement::disposing()
- {
- try
- {
- Reference< XComponent > xPanelComponent( m_xToolPanel, UNO_QUERY_THROW );
- xPanelComponent->dispose();
- }
- catch( const Exception& )
- {
- DBG_UNHANDLED_EXCEPTION();
- }
- }
-
-//......................................................................................................................
-} } // namespace sd::toolpanel
-//......................................................................................................................
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/toolpanel/ToolPanelUIElement.hxx b/sd/source/ui/toolpanel/ToolPanelUIElement.hxx
deleted file mode 100644
index 567344d1101a..000000000000
--- a/sd/source/ui/toolpanel/ToolPanelUIElement.hxx
+++ /dev/null
@@ -1,78 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#ifndef SD_TOOLPANELUIELEMENT_HXX
-#define SD_TOOLPANELUIELEMENT_HXX
-
-#include <com/sun/star/ui/XUIElement.hpp>
-#include <com/sun/star/ui/XToolPanel.hpp>
-
-#include <cppuhelper/compbase1.hxx>
-#include <cppuhelper/basemutex.hxx>
-
-#include <memory>
-
-//......................................................................................................................
-namespace sd { namespace toolpanel
-{
-//......................................................................................................................
-
- //==================================================================================================================
- //= ToolPanelUIElement
- //==================================================================================================================
- typedef ::cppu::WeakComponentImplHelper1 < ::com::sun::star::ui::XUIElement
- > ToolPanelUIElement_Base;
- class ToolPanelUIElement :public ::cppu::BaseMutex
- ,public ToolPanelUIElement_Base
- {
- public:
- ToolPanelUIElement(
- const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& i_rFrame,
- const OUString& i_rResourceURL,
- const ::com::sun::star::uno::Reference< ::com::sun::star::ui::XToolPanel >& i_rToolPanel
- );
-
- // XUIElement
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > SAL_CALL getFrame() throw (::com::sun::star::uno::RuntimeException);
- virtual OUString SAL_CALL getResourceURL() throw (::com::sun::star::uno::RuntimeException);
- virtual ::sal_Int16 SAL_CALL getType() throw (::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL getRealInterface( ) throw (::com::sun::star::uno::RuntimeException);
-
- void checkDisposed();
- ::osl::Mutex& getMutex() { return m_aMutex; }
-
- protected:
- virtual ~ToolPanelUIElement();
-
- // OComponentHelper
- virtual void SAL_CALL disposing();
-
- private:
- const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > m_xFrame;
- const OUString m_sResourceURL;
- const ::com::sun::star::uno::Reference< ::com::sun::star::ui::XToolPanel > m_xToolPanel;
- };
-
-//......................................................................................................................
-} } // namespace sd::toolpanel
-//......................................................................................................................
-
-#endif // SD_TOOLPANELUIELEMENT_HXX
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/toolpanel/ToolPanelViewShell.cxx b/sd/source/ui/toolpanel/ToolPanelViewShell.cxx
deleted file mode 100644
index 081a77baede2..000000000000
--- a/sd/source/ui/toolpanel/ToolPanelViewShell.cxx
+++ /dev/null
@@ -1,895 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-
-#include "taskpane/ToolPanelViewShell.hxx"
-
-#include "TaskPaneShellManager.hxx"
-#include "TaskPaneFocusManager.hxx"
-#include "taskpane/TaskPaneControlFactory.hxx"
-#include "controls/MasterPagesPanel.hxx"
-#include "LayoutMenu.hxx"
-#include "DrawDocShell.hxx"
-#include "controls/TableDesignPanel.hxx"
-#include "controls/CustomAnimationPanel.hxx"
-#include "controls/SlideTransitionPanel.hxx"
-#include "controls/MasterPagesSelector.hxx"
-#include "ToolPanel.hxx"
-#include "ToolPanelUIElement.hxx"
-#include "PaneDockingWindow.hxx"
-#include "FrameView.hxx"
-#include "Window.hxx"
-#include "sdmod.hxx"
-#include "app.hrc"
-#include "glob.hrc"
-#include "res_bmp.hrc"
-#include "helpids.h"
-#include "strings.hrc"
-#include "sdresid.hxx"
-#include "framework/FrameworkHelper.hxx"
-
-#include <com/sun/star/drawing/framework/XResourceId.hpp>
-#include <com/sun/star/drawing/framework/ResourceActivationMode.hpp>
-#include <com/sun/star/drawing/framework/AnchorBindingMode.hpp>
-#include <com/sun/star/drawing/XDrawSubController.hpp>
-
-#include <svtools/toolpanel/toolpanel.hxx>
-#include <svtools/toolpanel/toolpaneldeck.hxx>
-#include <svx/dlgctrl.hxx>
-#include <sfx2/taskpane.hxx>
-#include <sfx2/imagemgr.hxx>
-#include <sfx2/bindings.hxx>
-#include <sfx2/dispatch.hxx>
-#include <sfx2/viewfrm.hxx>
-#include <sfx2/msg.hxx>
-#include <sfx2/objface.hxx>
-#include <svx/colrctrl.hxx>
-#include <svx/xtable.hxx>
-#include <vcl/dockwin.hxx>
-#include "sdtreelb.hxx"
-#include "DrawViewShell.hxx"
-#include "drawdoc.hxx"
-#include "ViewShellBase.hxx"
-#include <svx/ruler.hxx>
-#include <vcl/svapp.hxx>
-#include <vcl/toolbox.hxx>
-#include <tools/diagnose_ex.h>
-#include <unotools/confignode.hxx>
-#include <comphelper/processfactory.hxx>
-#include <cppuhelper/implbase1.hxx>
-#include <cppuhelper/basemutex.hxx>
-
-#include <vector>
-
-using namespace ::sd::toolpanel;
-
-#define ToolPanelViewShell
-#include "sdslots.hxx"
-
-using ::com::sun::star::uno::Reference;
-using ::com::sun::star::uno::XInterface;
-using ::com::sun::star::uno::UNO_QUERY;
-using ::com::sun::star::uno::UNO_QUERY_THROW;
-using ::com::sun::star::uno::UNO_SET_THROW;
-using ::com::sun::star::uno::Exception;
-using ::com::sun::star::uno::RuntimeException;
-using ::com::sun::star::uno::Any;
-using ::com::sun::star::uno::makeAny;
-using ::com::sun::star::uno::Sequence;
-using ::com::sun::star::uno::Type;
-using ::com::sun::star::accessibility::XAccessible;
-using ::com::sun::star::drawing::XDrawSubController;
-using ::com::sun::star::frame::XFrame;
-using ::com::sun::star::drawing::framework::XResourceId;
-using ::com::sun::star::drawing::framework::XConfigurationChangeListener;
-using ::com::sun::star::drawing::framework::ConfigurationChangeEvent;
-using ::com::sun::star::lang::EventObject;
-using ::com::sun::star::lang::DisposedException;
-using ::com::sun::star::drawing::framework::XConfigurationControllerBroadcaster;
-using ::com::sun::star::drawing::framework::XConfigurationController;
-using ::com::sun::star::drawing::framework::XConfiguration;
-using ::com::sun::star::drawing::framework::AnchorBindingMode_DIRECT;
-using ::com::sun::star::ui::XUIElement;
-using ::com::sun::star::ui::XToolPanel;
-using ::com::sun::star::drawing::framework::ResourceActivationMode_REPLACE;
-
-using ::sd::framework::FrameworkHelper;
-
-namespace sd { namespace toolpanel {
-
-// =====================================================================================================================
-// = misc helper
-// =====================================================================================================================
-// ---------------------------------------------------------------------------------------------------------------------
-PanelId GetStandardPanelId( const OUString& i_rTaskPanelResourceURL, const bool i_bIgnoreUnknown )
-{
- PanelId ePanelId( PID_UNKNOWN );
-
- if ( i_rTaskPanelResourceURL.equals( FrameworkHelper::msMasterPagesTaskPanelURL ) )
- {
- ePanelId = PID_MASTER_PAGES;
- }
- else if ( i_rTaskPanelResourceURL.equals( FrameworkHelper::msLayoutTaskPanelURL ) )
- {
- ePanelId = PID_LAYOUT;
- }
- else if ( i_rTaskPanelResourceURL.equals( FrameworkHelper::msTableDesignPanelURL ) )
- {
- ePanelId = PID_TABLE_DESIGN;
- }
- else if ( i_rTaskPanelResourceURL.equals( FrameworkHelper::msCustomAnimationTaskPanelURL ) )
- {
- ePanelId = PID_CUSTOM_ANIMATION;
- }
- else if ( i_rTaskPanelResourceURL.equals( FrameworkHelper::msSlideTransitionTaskPanelURL ) )
- {
- ePanelId = PID_SLIDE_TRANSITION;
- }
- else
- {
- OSL_ENSURE( i_bIgnoreUnknown, "GetStandardPanelId: cannot translate the given resource URL!" );
- (void)i_bIgnoreUnknown;
- }
-
- return ePanelId;
-}
-
-// ---------------------------------------------------------------------------------------------------------------------
-PanelId GetStandardPanelId( const OUString& i_rTaskPanelResourceURL )
-{
- return GetStandardPanelId( i_rTaskPanelResourceURL, false );
-}
-
-// =====================================================================================================================
-// = ConfigurationListener - declaration
-// =====================================================================================================================
-typedef ::cppu::WeakImplHelper1 < XConfigurationChangeListener
- > ConfigurationListener_Base;
-
-class ConfigurationListener :public ::cppu::BaseMutex
- ,public ConfigurationListener_Base
-{
-public:
- ConfigurationListener( ToolPanelViewShell_Impl& i_rShellImpl );
-
- // XConfigurationChangeListener
- virtual void SAL_CALL notifyConfigurationChange( const ConfigurationChangeEvent& aEvent ) throw (RuntimeException);
-
- // XEventListener
- virtual void SAL_CALL disposing( const EventObject& Source ) throw (RuntimeException);
-
- // XComponent equivalents (not available per UNO interface)
- void dispose();
-
-protected:
- ~ConfigurationListener();
-
- void impl_checkDisposed_throw()
- {
- if ( !m_pShellImpl )
- throw DisposedException( OUString(), *this );
- }
-
-private:
- ToolPanelViewShell_Impl* m_pShellImpl;
-};
-
-// =====================================================================================================================
-// = ToolPanelViewShell_Impl - declaration
-// =====================================================================================================================
-/** Inner implementation class of ToolPanelViewShell.
-*/
-class ToolPanelViewShell_Impl :public ::boost::noncopyable
- ,public ::svt::IToolPanelDeckListener
- ,public ::sfx2::IToolPanelCompare
-{
-public:
- static const size_t mnInvalidId = static_cast< size_t >( -1 );
-
- ToolPanelViewShell_Impl( ToolPanelViewShell& i_rPanelViewShell, ::Window& i_rPanelDeckParent );
- virtual ~ToolPanelViewShell_Impl();
-
- ToolPanelViewShell& GetAntiImpl() { return m_rPanelViewShell; }
-
- /** Here the panels are created that are shown in the task pane.
- */
- void Setup();
-
- /** clean up the instance
- */
- void Cleanup();
-
- /** activates the panel which has the given resource URL
- */
- void ActivatePanelByResource( const OUString& i_rPanelResourceURL );
-
- /** de-activates the panel given by its resource URL, bypassing the configuration controller
-
- If the panel is not active currently, nothing happens.
- */
- void DeactivatePanelByResource( const OUString& i_rPanelResourceURL );
-
- /** provides access to the VCL window of the panel deck
- */
- ::sfx2::ModuleTaskPane& GetTaskPane() { return *m_pTaskPane; }
- const ::sfx2::ModuleTaskPane& GetTaskPane() const { return *m_pTaskPane; }
-
- ::svt::ToolPanelDeck& GetToolPanelDeck() { return GetTaskPane().GetPanelDeck(); }
- const ::svt::ToolPanelDeck& GetToolPanelDeck() const { return GetTaskPane().GetPanelDeck(); }
-
- Reference< XAccessible >
- CreateAccessible( ::sd::Window& i_rWindow );
-
- void ConnectToDockingWindow();
-
-private:
- // IToolPanelDeckListener overridables
- virtual void PanelInserted( const ::svt::PToolPanel& i_pPanel, const size_t i_nPosition );
- virtual void PanelRemoved( const size_t i_nPosition );
- virtual void ActivePanelChanged( const ::boost::optional< size_t >& i_rOldActive, const ::boost::optional< size_t >& i_rNewActive );
- virtual void LayouterChanged( const ::svt::PDeckLayouter& i_rNewLayouter );
- virtual void Dying();
-
- // IToolPanelCompare overridables
- virtual short compareToolPanelsURLs( const OUString& i_rLHS, const OUString& i_rRHS ) const;
-
-private:
- struct InitialPanel
- {
- OUString sPanelResourceURL;
- bool bActivateDirectly;
- InitialPanel()
- :sPanelResourceURL()
- ,bActivateDirectly( true )
- {
- }
- };
- InitialPanel impl_determineInitialPanel();
- OUString impl_getPanelURL( const ::boost::optional< size_t >& i_rPanel );
-
-private:
- ToolPanelViewShell& m_rPanelViewShell;
- ::boost::scoped_ptr< ::sfx2::ModuleTaskPane > m_pTaskPane;
- SAL_WNODEPRECATED_DECLARATIONS_PUSH
- ::std::auto_ptr< ::sfx2::TaskPaneController > m_pTaskPaneController;
- SAL_WNODEPRECATED_DECLARATIONS_POP
- ::rtl::Reference< ConfigurationListener > m_pConfigListener;
- bool m_bInitialized;
-};
-
-// =====================================================================================================================
-// = ConfigurationListener - implementation
-// =====================================================================================================================
-// ---------------------------------------------------------------------------------------------------------------------
-ConfigurationListener::ConfigurationListener( ToolPanelViewShell_Impl& i_rShellImpl )
- :m_pShellImpl( &i_rShellImpl )
-{
- ::boost::shared_ptr< FrameworkHelper > pFrameworkHelper( FrameworkHelper::Instance( i_rShellImpl.GetAntiImpl().GetViewShellBase() ) );
- Reference< XConfigurationControllerBroadcaster > xBroadcaster;
- if ( pFrameworkHelper.get() )
- xBroadcaster.set( pFrameworkHelper->GetConfigurationController().get() );
- ENSURE_OR_THROW( pFrameworkHelper.get(), "no access to the config controller" );
-
- osl_atomic_increment( &m_refCount );
- {
- xBroadcaster->addConfigurationChangeListener( this, OUString(), Any() );
- }
- osl_atomic_decrement( &m_refCount );
-}
-
-// ---------------------------------------------------------------------------------------------------------------------
-ConfigurationListener::~ConfigurationListener()
-{
-}
-
-// ---------------------------------------------------------------------------------------------------------------------
-void SAL_CALL ConfigurationListener::notifyConfigurationChange( const ConfigurationChangeEvent& i_rEvent ) throw (RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- impl_checkDisposed_throw();
-
- // is this an event we're interested in?
- if ( i_rEvent.Type != FrameworkHelper::msResourceActivationEvent )
- return;
-
- // is this a resource we're interested in? Must be anchored in the task pane ...
- Reference< XResourceId > xAnchorId;
- if ( i_rEvent.ResourceId.is() )
- xAnchorId = i_rEvent.ResourceId->getAnchor();
- if ( !xAnchorId.is() )
- return;
- const OUString sAnchorURL( xAnchorId->getResourceURL() );
- if ( sAnchorURL != FrameworkHelper::msTaskPaneURL )
- return;
-
- m_pShellImpl->ActivatePanelByResource( i_rEvent.ResourceId->getResourceURL() );
-}
-
-// ---------------------------------------------------------------------------------------------------------------------
-void SAL_CALL ConfigurationListener::disposing( const EventObject& i_rEvent ) throw (RuntimeException)
-{
- (void)i_rEvent;
- {
- ::osl::MutexGuard aGuard( m_aMutex );
- impl_checkDisposed_throw();
- }
-
- dispose();
-}
-
-// ---------------------------------------------------------------------------------------------------------------------
-void ConfigurationListener::dispose()
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- m_pShellImpl = NULL;
-}
-
-// =====================================================================================================================
-// = ToolPanelViewShell
-// =====================================================================================================================
-// ---------------------------------------------------------------------------------------------------------------------
-SFX_IMPL_INTERFACE(ToolPanelViewShell, SfxShell, SdResId(STR_TASKPANEVIEWSHELL))
-{
-}
-
-// ---------------------------------------------------------------------------------------------------------------------
-TYPEINIT1(ToolPanelViewShell, ViewShell);
-
-// ---------------------------------------------------------------------------------------------------------------------
-ToolPanelViewShell_Impl::InitialPanel ToolPanelViewShell_Impl::impl_determineInitialPanel()
-{
- InitialPanel aPanelToActivate;
- if ( GetAntiImpl().GetViewShellBase().GetDocShell()->GetDocumentType() == DOCUMENT_TYPE_DRAW )
- // for Draw, rely on SFX's default handling, which is to activate the previously active panel
- return aPanelToActivate;
-
- // Default to Layout panel, but check whether the requested configuration already contains a tool panel, in this case,
- // use that one.
- aPanelToActivate.sPanelResourceURL = FrameworkHelper::msLayoutTaskPanelURL;
- aPanelToActivate.bActivateDirectly = false;
- try
- {
- ::boost::shared_ptr< FrameworkHelper > pFrameworkHelper( FrameworkHelper::Instance( m_rPanelViewShell.GetViewShellBase() ) );
- const Reference< XResourceId > xToolPanelId( pFrameworkHelper->CreateResourceId( FrameworkHelper::msTaskPaneURL, FrameworkHelper::msRightPaneURL ) );
- Reference< XConfigurationController > xCC( pFrameworkHelper->GetConfigurationController(), UNO_QUERY_THROW );
- Reference< XConfiguration > xConfiguration( xCC->getRequestedConfiguration(), UNO_QUERY_THROW );
- Sequence< Reference< XResourceId > > aViewIds( xConfiguration->getResources(
- FrameworkHelper::CreateResourceId( FrameworkHelper::msTaskPaneURL, FrameworkHelper::msRightPaneURL ),
- FrameworkHelper::msTaskPanelURLPrefix, AnchorBindingMode_DIRECT ) );
-
- if ( aViewIds.getLength() > 0 )
- {
- const OUString sResourceURL( aViewIds[0]->getResourceURL() );
- PanelId nRequestedPanel = GetStandardPanelId( sResourceURL );
- if ( nRequestedPanel != PID_UNKNOWN )
- {
- aPanelToActivate.sPanelResourceURL = sResourceURL;
- aPanelToActivate.bActivateDirectly = true;
- }
- }
- }
- catch( const Exception& )
- {
- DBG_UNHANDLED_EXCEPTION();
- }
- return aPanelToActivate;
-}
-
-// ---------------------------------------------------------------------------------------------------------------------
-void ToolPanelViewShell_Impl::Setup()
-{
- if ( m_bInitialized )
- return;
- m_bInitialized = true;
-
- // initially activate a panel
- const InitialPanel aInitialPanel = impl_determineInitialPanel();
- if ( !aInitialPanel.sPanelResourceURL.isEmpty() )
- {
- if ( aInitialPanel.bActivateDirectly )
- {
- ActivatePanelByResource( aInitialPanel.sPanelResourceURL );
- }
- else
- {
- ::boost::shared_ptr< FrameworkHelper > pFrameworkHelper( FrameworkHelper::Instance( GetAntiImpl().GetViewShellBase() ) );
- pFrameworkHelper->RequestSidebarPanel( aInitialPanel.sPanelResourceURL );
- }
- }
-
- // listen at the configuration
- m_pConfigListener.set( new ConfigurationListener( *this ) );
-
- m_pTaskPane->Show();
-}
-
-// ---------------------------------------------------------------------------------------------------------------------
-void ToolPanelViewShell_Impl::Cleanup()
-{
- if ( m_bInitialized )
- {
- if ( m_pConfigListener.is() )
- m_pConfigListener->dispose();
- }
- GetToolPanelDeck().RemoveListener( *this );
- m_pTaskPaneController.reset();
- m_pTaskPane.reset();
-}
-
-// ---------------------------------------------------------------------------------------------------------------------
-void ToolPanelViewShell_Impl::ActivatePanelByResource( const OUString& i_rResourceURL )
-{
- // determine position of the requested panel
- ::boost::optional< size_t > aPanelPos = GetTaskPane().GetPanelPos( i_rResourceURL );
- OSL_ENSURE( !!aPanelPos, "ToolPanelViewShell_Impl::ActivatePanelByResource: illegal panel resource, or illegal panel deck setup!" );
- if ( !!aPanelPos )
- GetToolPanelDeck().ActivatePanel( *aPanelPos );
-}
-
-// ---------------------------------------------------------------------------------------------------------------------
-void ToolPanelViewShell_Impl::DeactivatePanelByResource( const OUString& i_rPanelResourceURL )
-{
- // determine position of the requested panel
- ::boost::optional< size_t > aPanelPos = GetTaskPane().GetPanelPos( i_rPanelResourceURL );
- OSL_ENSURE( !!aPanelPos, "ToolPanelViewShell_Impl::DeactivatePanelByResource: illegal panel resource, or illegal panel deck setup!" );
- if ( !!aPanelPos )
- {
- if ( GetToolPanelDeck().GetActivePanel() == *aPanelPos )
- GetToolPanelDeck().ActivatePanel( ::boost::optional< size_t >() );
- }
-}
-
-// ---------------------------------------------------------------------------------------------------------------------
-void ToolPanelViewShell::Initialize()
-{
- mpImpl->Setup();
-}
-
-// ---------------------------------------------------------------------------------------------------------------------
-ToolPanelViewShell::ToolPanelViewShell( SfxViewFrame* pFrame, ViewShellBase& rViewShellBase, ::Window* pParentWindow,
- FrameView* pFrameViewArgument )
- :ViewShell(pFrame, pParentWindow, rViewShellBase)
- ,mpImpl( new ToolPanelViewShell_Impl( *this, *mpContentWindow.get() ) )
- ,mpSubShellManager()
- ,mnMenuId(0)
-{
- doShow();
-
- meShellType = ST_TASK_PANE;
-
- mpContentWindow->SetCenterAllowed( false );
- pParentWindow->SetStyle( pParentWindow->GetStyle() | WB_DIALOGCONTROL );
-
- GetParentWindow()->SetBackground( Wallpaper() );
- mpContentWindow->SetBackground( Wallpaper() );
-
- GetParentWindow()->SetHelpId(HID_SD_TASK_PANE);
-
- mpImpl->ConnectToDockingWindow();
-
- SetPool( &GetDoc()->GetPool() );
-
- if ( pFrameViewArgument )
- mpFrameView = pFrameViewArgument;
- else
- mpFrameView = new FrameView( GetDoc() );
- GetFrameView()->Connect();
-
- // Hide or delete unused controls that we have inherited from the
- // ViewShell base class.
- mpHorizontalScrollBar.reset();
- mpVerticalScrollBar.reset();
- mpScrollBarBox.reset();
- mpHorizontalRuler.reset();
- mpVerticalRuler.reset();
-
- SetName( OUString( "ToolPanelViewShell" ) );
-
- // enforce the creation of the Accessible object here.
- // In some not-always-to-reproduce situations, creating the accessible on demand only leads to some
- // cycliy parenthood references between the involved objects, which make some AT tools (accerciser, in particular)
- // loop (which is /not/ a bug in the tool, of course).
- // However, since those situations were not reproducible anymore, we deliberately leave the Accessible creation
- // (which originally was intended as a workaround) herein. Better to be safe ...
- // Note that this is not a performance problem: The implementation of the ToolPanelDeck's Accessible
- // is separated from the implementation of its AccessibleContext (which even is in a separate library) - we only
- // create the former here, the latter is still created on demand, when somebody requests it.
- // #i113671# / 2010-09-17 / frank.schoenheit@oracle.com
- if (mpContentWindow.get())
- mpContentWindow->GetAccessible( sal_True );
-
- // For accessibility we have to shortly hide the content window. This
- // triggers the construction of a new accessibility object for the new
- // view shell. (One is created earlier while the construtor of the base
- // class is executed. At that time the correct accessibility object can
- // not be constructed.)
- if (mpContentWindow.get())
- {
- mpContentWindow->Hide();
- mpContentWindow->Show();
- }
-
- // Register the shell manager as factory at the ViewShellManager.
- mpSubShellManager.reset( new TaskPaneShellManager(
- GetViewShellBase().GetViewShellManager(),
- *this
- ) );
- GetViewShellBase().GetViewShellManager()->AddSubShellFactory( this, mpSubShellManager );
-}
-
-// ---------------------------------------------------------------------------------------------------------------------
-ToolPanelViewShell::~ToolPanelViewShell()
-{
- mpImpl->Cleanup();
-
- // reset our impl before destroying the panel deck, to ensure the hidden panels are properly
- // disposed/destroyed, too
- mpImpl.reset();
- GetViewShellBase().GetViewShellManager()->RemoveSubShellFactory(this, mpSubShellManager);
- GetFrameView()->Disconnect();
-}
-
-// ---------------------------------------------------------------------------------------------------------------------
-// static
-void ToolPanelViewShell::RegisterControls()
-{
- SfxModule* pModule = SD_MOD();
- controls::MasterPagesSelector::RegisterInterface( pModule );
- LayoutMenu::RegisterInterface( pModule );
-}
-
-// ---------------------------------------------------------------------------------------------------------------------
-void ToolPanelViewShell::ArrangeGUIElements()
-{
- ViewShell::ArrangeGUIElements();
-
- Initialize();
-
- mpImpl->GetTaskPane().SetPosSizePixel( Point(), maViewSize );
-}
-
-// ---------------------------------------------------------------------------------------------------------------------
-void ToolPanelViewShell::GetFocus()
-{
- Invalidate();
-}
-
-// ---------------------------------------------------------------------------------------------------------------------
-void ToolPanelViewShell::LoseFocus()
-{
- Invalidate();
-}
-
-// ---------------------------------------------------------------------------------------------------------------------
-void ToolPanelViewShell::KeyInput( const KeyEvent& i_rKeyEvent )
-{
- const KeyCode nCode = i_rKeyEvent.GetKeyCode();
- if ( nCode == KEY_RETURN )
- {
- if ( !mpImpl->GetTaskPane().HasChildPathFocus() )
- mpImpl->GetTaskPane().GrabFocus();
- }
- else
- ViewShell::KeyInput( i_rKeyEvent, NULL );
-}
-
-// ---------------------------------------------------------------------------------------------------------------------
-SdPage* ToolPanelViewShell::GetActualPage()
-{
- return NULL;
-}
-
-// ---------------------------------------------------------------------------------------------------------------------
-SdPage* ToolPanelViewShell::getCurrentPage() const
-{
- return NULL;
-}
-
-// ---------------------------------------------------------------------------------------------------------------------
-TaskPaneShellManager& ToolPanelViewShell::GetSubShellManager() const
-{
- return *mpSubShellManager.get();
-}
-
-// ---------------------------------------------------------------------------------------------------------------------
-DockingWindow* ToolPanelViewShell::GetDockingWindow()
-{
- ::Window* pParentWindow = GetParentWindow();
- DockingWindow* pDockingWindow = NULL;
- while (pParentWindow!=NULL && pDockingWindow==NULL)
- {
- pDockingWindow = dynamic_cast<DockingWindow*>(pParentWindow);
- pParentWindow = pParentWindow->GetParent();
- }
- return pDockingWindow;
-}
-
-// ---------------------------------------------------------------------------------------------------------------------
-Reference< XAccessible > ToolPanelViewShell::CreateAccessibleDocumentView( ::sd::Window* i_pWindow )
-{
- ENSURE_OR_RETURN( i_pWindow, "ToolPanelViewShell::CreateAccessibleDocumentView: illegal window!", NULL );
- return mpImpl->CreateAccessible( *i_pWindow );
-}
-
-// ---------------------------------------------------------------------------------------------------------------------
-Reference< XDrawSubController > ToolPanelViewShell::CreateSubController()
-{
- // This view shell is not designed to be the main view shell and thus
- // does not support a UNO sub controller.
- return Reference< XDrawSubController >();
-}
-
-// ---------------------------------------------------------------------------------------------------------------------
-bool ToolPanelViewShell::RelocateToParentWindow( ::Window* pParentWindow )
-{
- ::Window* pOldParentWindow = GetParentWindow();
- FocusManager::Instance().RemoveLinks( pOldParentWindow, &mpImpl->GetTaskPane() );
- FocusManager::Instance().RemoveLinks( &mpImpl->GetTaskPane(), pOldParentWindow );
-
- PaneDockingWindow* pDockingWindow = dynamic_cast< PaneDockingWindow* >( GetDockingWindow() );
- if ( pDockingWindow != NULL )
- {
- pDockingWindow->SetEndDockingHdl( Link() );
- }
-
- ViewShell::RelocateToParentWindow(pParentWindow);
-
- mpImpl->ConnectToDockingWindow();
-
- Resize();
-
- return true;
-}
-
-//---------------------------------------------------------------------------------------------------------------------
-bool ToolPanelViewShell::IsPanelAnchorWindow( const ::Window& i_rWindow ) const
-{
- return &mpImpl->GetToolPanelDeck().GetPanelWindowAnchor() == &i_rWindow;
-}
-
-//---------------------------------------------------------------------------------------------------------------------
-namespace
-{
- typedef std::auto_ptr< ControlFactory > (*ControlFactoryFactory)( ToolPanelViewShell& i_rToolPanelShell );
-
- struct PanelFactory
- {
- ControlFactoryFactory pFactory;
- OString sHelpID;
- PanelFactory( const ControlFactoryFactory i_pFactory, const OString& i_nHelpID )
- :pFactory( i_pFactory )
- ,sHelpID( i_nHelpID )
- {
- }
- };
-
- const PanelFactory lcl_describePanel( const PanelId i_ePanelId )
- {
- switch ( i_ePanelId )
- {
- case PID_MASTER_PAGES:
- return PanelFactory( &controls::MasterPagesPanel::CreateControlFactory, HID_SD_SLIDE_DESIGNS );
- case PID_LAYOUT:
- return PanelFactory( &LayoutMenu::CreateControlFactory, HID_SD_SLIDE_LAYOUTS );
- case PID_TABLE_DESIGN:
- return PanelFactory( &controls::TableDesignPanel::CreateControlFactory, HID_SD_TABLE_DESIGN );
- case PID_CUSTOM_ANIMATION:
- return PanelFactory( &controls::CustomAnimationPanel::CreateControlFactory, HID_SD_CUSTOM_ANIMATIONS );
- case PID_SLIDE_TRANSITION:
- return PanelFactory( &controls::SlideTransitionPanel::CreateControlFactory, HID_SD_SLIDE_TRANSITIONS );
- default:
- break;
- }
- throw RuntimeException( "illegal panel ID" , NULL );
- }
-}
-
-//---------------------------------------------------------------------------------------------------------------------
-Reference< XUIElement > ToolPanelViewShell::CreatePanelUIElement( const Reference< XFrame >& i_rDocFrame, const OUString& i_rPanelResourceURL )
-{
- const PanelId ePanelId( GetStandardPanelId( i_rPanelResourceURL ) );
- ENSURE_OR_RETURN( ePanelId != PID_UNKNOWN, "ToolPanelViewShell::CreatePanelUIElement: illegal panel URL!", NULL );
-
- // a TreeNode which will resemble the panel
- const PanelFactory aPanelFactory( lcl_describePanel( ePanelId ) );
- SAL_WNODEPRECATED_DECLARATIONS_PUSH
- ::std::auto_ptr< ControlFactory > pControlFactory( (*aPanelFactory.pFactory)( *this ) );
- ::std::auto_ptr< TreeNode > pNode( pControlFactory->CreateControl( mpImpl->GetToolPanelDeck().GetPanelWindowAnchor() ) );
- SAL_WNODEPRECATED_DECLARATIONS_POP
- ENSURE_OR_THROW( ( pNode.get() != NULL ) && ( pNode->GetWindow() != NULL ),
- "illegal node returned by the control factory" );
- pNode->GetWindow()->SetHelpId( aPanelFactory.sHelpID );
-
- // create an XToolPanel
- Reference< XToolPanel > xPanel( new ToolPanel( pNode ) );
-
- // create an XUIElement providing this panel
- const Reference< XUIElement > xUIElement( new ToolPanelUIElement( i_rDocFrame, i_rPanelResourceURL, xPanel ) );
-
- return xUIElement;
-}
-
-// ---------------------------------------------------------------------------------------------------------------------
-void ToolPanelViewShell::ActivatePanel( const OUString& i_rPanelResourceURL )
-{
- OSL_ENSURE( i_rPanelResourceURL.indexOf( FrameworkHelper::msTaskPanelURLPrefix ) < 0,
- "ToolPanelViewShell::ActivatePanel: for drawing-framework-controller panels, please use FrameworkHelper::RequestTaskPanel!" );
- mpImpl->ActivatePanelByResource( i_rPanelResourceURL );
-}
-
-// ---------------------------------------------------------------------------------------------------------------------
-void ToolPanelViewShell::DeactivatePanel( const OUString& i_rPanelResourceURL )
-{
- mpImpl->DeactivatePanelByResource( i_rPanelResourceURL );
-}
-
-// =====================================================================================================================
-// = ToolPanelViewShell_Impl - implementation
-// =====================================================================================================================
-// ---------------------------------------------------------------------------------------------------------------------
-ToolPanelViewShell_Impl::ToolPanelViewShell_Impl( ToolPanelViewShell& i_rPanelViewShell, ::Window& i_rPanelDeckParent )
- :m_rPanelViewShell( i_rPanelViewShell )
- ,m_pTaskPane( new ::sfx2::ModuleTaskPane( i_rPanelDeckParent, i_rPanelViewShell.GetViewShellBase().GetViewFrame()->GetFrame().GetFrameInterface(), *this ) )
- ,m_bInitialized( false )
-{
- const OUString sPaneTitle( SdResId( STR_RIGHT_PANE_TITLE ) );
- GetToolPanelDeck().SetAccessibleName( sPaneTitle );
- GetToolPanelDeck().SetAccessibleDescription( sPaneTitle );
-
- GetToolPanelDeck().AddListener( *this );
-}
-
-// ---------------------------------------------------------------------------------------------------------------------
-ToolPanelViewShell_Impl::~ToolPanelViewShell_Impl()
-{
-}
-
-// ---------------------------------------------------------------------------------------------------------------------
-void ToolPanelViewShell_Impl::PanelInserted( const ::svt::PToolPanel& i_pPanel, const size_t i_nPosition )
-{
- // not interested in
- (void)i_pPanel;
- (void)i_nPosition;
-}
-
-// ---------------------------------------------------------------------------------------------------------------------
-void ToolPanelViewShell_Impl::PanelRemoved( const size_t i_nPosition )
-{
- // not interested in
- (void)i_nPosition;
-}
-
-// ---------------------------------------------------------------------------------------------------------------------
-OUString ToolPanelViewShell_Impl::impl_getPanelURL( const ::boost::optional< size_t >& i_rPanel )
-{
- OUString sPanelURL;
- if ( !!i_rPanel )
- {
- sPanelURL = GetTaskPane().GetPanelResourceURL( *i_rPanel );
- const PanelId ePanelId( GetStandardPanelId( sPanelURL, true ) );
- if ( ePanelId == PID_UNKNOWN )
- sPanelURL = OUString();
- }
- return sPanelURL;
-}
-
-// ---------------------------------------------------------------------------------------------------------------------
-void ToolPanelViewShell_Impl::ActivePanelChanged( const ::boost::optional< size_t >& i_rOldActive, const ::boost::optional< size_t >& i_rNewActive )
-{
- // update the configuration controller, since this change in the active panel might have been triggered by means other
- // than the drawing framework, so it does not yet know about it.
-
- const OUString sOldPanelURL( impl_getPanelURL( i_rOldActive ) );
- const OUString sNewPanelURL( impl_getPanelURL( i_rNewActive ) );
-
- const ::boost::shared_ptr< FrameworkHelper > pFrameworkHelper( FrameworkHelper::Instance( GetAntiImpl().GetViewShellBase() ) );
- if ( !sNewPanelURL.isEmpty() )
- {
- // activate the resource belonging to the new panel. This will automatically de-activate the previously active
- // panel resource (since ResourceActivationMode_REPLACE is used)
- pFrameworkHelper->RequestSidebarPanel( sNewPanelURL );
- }
- else if ( !sOldPanelURL.isEmpty() )
- {
- // there is no new active panel, or it is not one of our standard panels, i.e. it is not covered by the
- // resource framework. => Deactivate the old resource.
- try
- {
- Reference< XConfigurationController > xConfigController( pFrameworkHelper->GetConfigurationController(), UNO_QUERY_THROW );
- xConfigController->requestResourceDeactivation(
- pFrameworkHelper->CreateResourceId(
- sOldPanelURL,
- FrameworkHelper::msTaskPaneURL,
- FrameworkHelper::msRightPaneURL
- )
- );
- }
- catch( const Exception& )
- {
- DBG_UNHANDLED_EXCEPTION();
- }
- }
-}
-
-// ---------------------------------------------------------------------------------------------------------------------
-void ToolPanelViewShell_Impl::LayouterChanged( const ::svt::PDeckLayouter& i_rNewLayouter )
-{
- // not interested in
- (void)i_rNewLayouter;
-}
-
-// ---------------------------------------------------------------------------------------------------------------------
-void ToolPanelViewShell_Impl::Dying()
-{
- // not interested in
-}
-
-// ---------------------------------------------------------------------------------------------------------------------
-short ToolPanelViewShell_Impl::compareToolPanelsURLs( const OUString& i_rLHS, const OUString& i_rRHS ) const
-{
- const PanelId eLHS( GetStandardPanelId( i_rLHS, true ) );
- const PanelId eRHS( GetStandardPanelId( i_rRHS, true ) );
- if ( eLHS < eRHS )
- return -1;
- if ( eLHS == eRHS )
- return 0;
- return 1;
-}
-
-// ---------------------------------------------------------------------------------------------------------------------
-void ToolPanelViewShell_Impl::ConnectToDockingWindow()
-{
- m_pTaskPaneController.reset();
- DockingWindow* pDockingWindow( GetAntiImpl().GetDockingWindow() );
- if ( pDockingWindow )
- {
- PaneDockingWindow* pPaneDockingWindow = dynamic_cast< PaneDockingWindow* >( pDockingWindow );
- OSL_ENSURE( pPaneDockingWindow, "ToolPanelViewShell_Impl::ConnectToDockingWindow: unsupported docking window type!" );
- if ( pPaneDockingWindow != NULL )
- m_pTaskPaneController.reset( new ::sfx2::TaskPaneController( GetTaskPane(), *pPaneDockingWindow ) );
- }
-
- // Tell the focus manager that we want to pass the focus to our
- // child.
- FocusManager::Instance().RegisterDownLink( GetAntiImpl().GetParentWindow(), &GetTaskPane() );
-}
-
-// ---------------------------------------------------------------------------------------------------------------------
-Reference< XAccessible > ToolPanelViewShell_Impl::CreateAccessible( ::sd::Window& i_rWindow )
-{
- Reference< XAccessible > xAccessible( GetToolPanelDeck().GetAccessible( sal_False ) );
- if ( !xAccessible.is() )
- {
- // determine the XAccessible which is the parent of the to-be-created object
- ::Window* pAccessibleParent = i_rWindow.GetAccessibleParentWindow();
- OSL_ENSURE( pAccessibleParent, "ToolPanelViewShell_Impl::CreateAccessible: illegal accessible parent provided by the sd::Window!" );
- GetToolPanelDeck().SetAccessibleParentWindow( pAccessibleParent );
-
- xAccessible = GetToolPanelDeck().GetAccessible( sal_True );
- ENSURE_OR_RETURN( xAccessible.is(), "ToolPanelViewShell_Impl::CreateAccessible: illegal ToolPanelDeck accessible!", NULL );
- OSL_ENSURE( xAccessible->getAccessibleContext().is()
- && xAccessible->getAccessibleContext()->getAccessibleParent() == pAccessibleParent->GetAccessible(),
- "ToolPanelViewShell_Impl::CreateAccessible: illegal parenthood!" );
- }
- return xAccessible;
-}
-
-} } // end of namespace ::sd::toolpanel
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/toolpanel/controls/AllMasterPagesSelector.cxx b/sd/source/ui/toolpanel/controls/AllMasterPagesSelector.cxx
deleted file mode 100644
index fe6ca42c2a5d..000000000000
--- a/sd/source/ui/toolpanel/controls/AllMasterPagesSelector.cxx
+++ /dev/null
@@ -1,199 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-
-#include "AllMasterPagesSelector.hxx"
-#include "PreviewValueSet.hxx"
-#include "app.hrc"
-#include "MasterPageContainer.hxx"
-#include "MasterPageDescriptor.hxx"
-#include <set>
-
-namespace {
-
-using namespace sd::toolpanel::controls;
-
-int GetURLPriority (const SharedMasterPageDescriptor& rpDescriptor)
-{
- int nPriority (0);
- switch (rpDescriptor->GetURLClassification())
- {
- case MasterPageDescriptor::URLCLASS_USER: nPriority = 0; break;
- case MasterPageDescriptor::URLCLASS_LAYOUT: nPriority = 1; break;
- case MasterPageDescriptor::URLCLASS_PRESENTATION: nPriority = 2; break;
- case MasterPageDescriptor::URLCLASS_OTHER: nPriority = 3; break;
- case MasterPageDescriptor::URLCLASS_UNKNOWN: nPriority = 4; break;
- default:
- case MasterPageDescriptor::URLCLASS_UNDETERMINED: nPriority = 5; break;
- }
- return nPriority;
-}
-
-
-class MasterPageDescriptorOrder
-{
-public:
- bool operator() (const sd::toolpanel::controls::SharedMasterPageDescriptor& rp1,
- const sd::toolpanel::controls::SharedMasterPageDescriptor& rp2)
- {
- if (rp1->meOrigin == MasterPageContainer::DEFAULT)
- return true;
- else if (rp2->meOrigin == MasterPageContainer::DEFAULT)
- return false;
- else if (rp1->GetURLClassification() == rp2->GetURLClassification())
- return rp1->mnTemplateIndex < rp2->mnTemplateIndex;
- else
- return GetURLPriority(rp1) < GetURLPriority(rp2);
- }
-};
-
-} // end of anonymous namespace
-
-
-
-namespace sd { namespace toolpanel { namespace controls {
-
-class AllMasterPagesSelector::SortedMasterPageDescriptorList
- : public ::std::set<SharedMasterPageDescriptor,MasterPageDescriptorOrder>
-{
-public:
- SortedMasterPageDescriptorList (void) {}
-};
-
-
-
-
-AllMasterPagesSelector::AllMasterPagesSelector (
- TreeNode* pParent,
- SdDrawDocument& rDocument,
- ViewShellBase& rBase,
- DrawViewShell& rViewShell,
- const ::boost::shared_ptr<MasterPageContainer>& rpContainer)
- : MasterPagesSelector(pParent, rDocument, rBase, rpContainer),
- mrViewShell(rViewShell),
- mpSortedMasterPages(new SortedMasterPageDescriptorList())
-{
- SetName (OUString("AllMasterPagesSelector"));
- MasterPagesSelector::Fill();
-}
-
-
-
-
-AllMasterPagesSelector::~AllMasterPagesSelector (void)
-{
-}
-
-
-
-
-void AllMasterPagesSelector::Fill (ItemList& rItemList)
-{
- if (mpSortedMasterPages->empty())
- UpdateMasterPageList();
- UpdatePageSet(rItemList);
-}
-
-
-
-
-void AllMasterPagesSelector::NotifyContainerChangeEvent (
- const MasterPageContainerChangeEvent& rEvent)
-{
- switch (rEvent.meEventType)
- {
- case MasterPageContainerChangeEvent::CHILD_ADDED:
- AddItem(rEvent.maChildToken);
- MasterPagesSelector::Fill();
- break;
-
- case MasterPageContainerChangeEvent::INDEX_CHANGED:
- case MasterPageContainerChangeEvent::INDEXES_CHANGED:
- mpSortedMasterPages->clear();
- MasterPagesSelector::Fill();
- break;
-
- default:
- MasterPagesSelector::NotifyContainerChangeEvent(rEvent);
- break;
- }
-}
-
-
-
-
-void AllMasterPagesSelector::UpdateMasterPageList (void)
-{
- mpSortedMasterPages->clear();
- int nTokenCount = mpContainer->GetTokenCount();
- for (int i=0; i<nTokenCount; i++)
- AddItem(mpContainer->GetTokenForIndex(i));
-}
-
-
-
-
-void AllMasterPagesSelector::AddItem (MasterPageContainer::Token aToken)
-{
- switch (mpContainer->GetOriginForToken(aToken))
- {
- case MasterPageContainer::DEFAULT:
- case MasterPageContainer::TEMPLATE:
- // Templates are added only when coming from the
- // MasterPageContainerFiller so that they have an id which
- // defines their place in the list. Templates (pre) loaded from
- // RecentlyUsedMasterPages are ignored (they will be loaded
- // later by the MasterPageContainerFiller.)
- if (mpContainer->GetTemplateIndexForToken(aToken) >= 0)
- mpSortedMasterPages->insert(mpContainer->GetDescriptorForToken(aToken));
- break;
-
- default:
- break;
- }
-}
-
-
-
-
-void AllMasterPagesSelector::UpdatePageSet (ItemList& rItemList)
-{
- SortedMasterPageDescriptorList::const_iterator iDescriptor;
- SortedMasterPageDescriptorList::const_iterator iEnd (mpSortedMasterPages->end());
- for (iDescriptor=mpSortedMasterPages->begin(); iDescriptor!=iEnd; ++iDescriptor)
- rItemList.push_back((*iDescriptor)->maToken);
-}
-
-
-
-
-void AllMasterPagesSelector::GetState (SfxItemSet& rItemSet)
-{
- MasterPagesSelector::GetState(rItemSet);
-
- if (rItemSet.GetItemState(SID_TP_EDIT_MASTER) == SFX_ITEM_AVAILABLE)
- rItemSet.DisableItem(SID_TP_EDIT_MASTER);
-}
-
-
-
-
-} } } // end of namespace ::sd::toolpanel::control
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/toolpanel/controls/AllMasterPagesSelector.hxx b/sd/source/ui/toolpanel/controls/AllMasterPagesSelector.hxx
deleted file mode 100644
index 7774bcf482f5..000000000000
--- a/sd/source/ui/toolpanel/controls/AllMasterPagesSelector.hxx
+++ /dev/null
@@ -1,87 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#ifndef SD_TOOLPANEL_CONTROLS_ALL_MASTER_PAGES_SELECTOR_HXX
-#define SD_TOOLPANEL_CONTROLS_ALL_MASTER_PAGES_SELECTOR_HXX
-
-#include "MasterPagesSelector.hxx"
-
-#include <memory>
-
-namespace sd {
-class TemplateEntry;
-}
-
-namespace sd { namespace toolpanel { namespace controls {
-
-
-/** Show a list of all available master pages so that the user can assign
- them to the document.
-*/
-class AllMasterPagesSelector
- : public MasterPagesSelector
-{
-public:
- AllMasterPagesSelector (
- TreeNode* pParent,
- SdDrawDocument& rDocument,
- ViewShellBase& rBase,
- DrawViewShell& rViewShell,
- const ::boost::shared_ptr<MasterPageContainer>& rpContainer);
- virtual ~AllMasterPagesSelector (void);
-
- /** Scan the set of templates for the ones whose first master pages are
- shown by this control and store them in the MasterPageContainer.
- */
- virtual void Fill (ItemList& rItemList);
-
- virtual void GetState (SfxItemSet& rItemSet);
-
-protected:
- virtual void NotifyContainerChangeEvent (const MasterPageContainerChangeEvent& rEvent);
-
-private:
- DrawViewShell& mrViewShell;
-
- /** The list of master pages displayed by this class.
- */
- class SortedMasterPageDescriptorList;
- ::std::auto_ptr<SortedMasterPageDescriptorList> mpSortedMasterPages;
-
- void AddTemplate (const TemplateEntry& rEntry);
-
- void AddItem (MasterPageContainer::Token aToken);
-
- /** Add all items in the internal master page list into the given list.
- */
- void UpdatePageSet (ItemList& rItemList);
-
- /** Update the internal list of master pages that are to show in the
- control.
- */
- void UpdateMasterPageList (void);
-
- using sd::toolpanel::controls::MasterPagesSelector::Fill;
-};
-
-} } } // end of namespace ::sd::toolpanel::controls
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/toolpanel/controls/CurrentMasterPagesSelector.cxx b/sd/source/ui/toolpanel/controls/CurrentMasterPagesSelector.cxx
deleted file mode 100644
index 8cf807683c25..000000000000
--- a/sd/source/ui/toolpanel/controls/CurrentMasterPagesSelector.cxx
+++ /dev/null
@@ -1,334 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-
-#include "CurrentMasterPagesSelector.hxx"
-#include "PreviewValueSet.hxx"
-#include "ViewShellBase.hxx"
-#include "DrawViewShell.hxx"
-#include "drawdoc.hxx"
-#include "sdpage.hxx"
-#include "MasterPageContainer.hxx"
-#include "MasterPageDescriptor.hxx"
-#include "EventMultiplexer.hxx"
-#include "app.hrc"
-#include "DrawDocShell.hxx"
-#include "res_bmp.hrc"
-#include "sdresid.hxx"
-
-#include <vcl/image.hxx>
-#include <svx/svdmodel.hxx>
-#include <sfx2/request.hxx>
-
-#include <set>
-
-
-using namespace ::com::sun::star;
-
-namespace sd { namespace toolpanel { namespace controls {
-
-
-CurrentMasterPagesSelector::CurrentMasterPagesSelector (
- TreeNode* pParent,
- SdDrawDocument& rDocument,
- ViewShellBase& rBase,
- const ::boost::shared_ptr<MasterPageContainer>& rpContainer)
- : MasterPagesSelector (pParent, rDocument, rBase, rpContainer)
-{
- SetName(OUString("CurrentMasterPagesSelector"));
-
- // For this master page selector only we change the default action for
- // left clicks.
- mnDefaultClickAction = SID_TP_APPLY_TO_SELECTED_SLIDES;
-
- Link aLink (LINK(this,CurrentMasterPagesSelector,EventMultiplexerListener));
- rBase.GetEventMultiplexer()->AddEventListener(aLink,
- sd::tools::EventMultiplexerEvent::EID_CURRENT_PAGE
- | sd::tools::EventMultiplexerEvent::EID_EDIT_MODE_NORMAL
- | sd::tools::EventMultiplexerEvent::EID_EDIT_MODE_MASTER
- | sd::tools::EventMultiplexerEvent::EID_PAGE_ORDER
- | sd::tools::EventMultiplexerEvent::EID_SHAPE_CHANGED
- | sd::tools::EventMultiplexerEvent::EID_SHAPE_INSERTED
- | sd::tools::EventMultiplexerEvent::EID_SHAPE_REMOVED);
-}
-
-
-
-
-CurrentMasterPagesSelector::~CurrentMasterPagesSelector (void)
-{
- if (mrDocument.GetDocSh() != NULL)
- {
- EndListening(*mrDocument.GetDocSh());
- }
- else
- {
- OSL_ASSERT(mrDocument.GetDocSh() != NULL);
- }
-
- Link aLink (LINK(this,CurrentMasterPagesSelector,EventMultiplexerListener));
- mrBase.GetEventMultiplexer()->RemoveEventListener(aLink);
-}
-
-
-
-
-void CurrentMasterPagesSelector::LateInit (void)
-{
- MasterPagesSelector::LateInit();
- MasterPagesSelector::Fill();
- if (mrDocument.GetDocSh() != NULL)
- {
- StartListening(*mrDocument.GetDocSh());
- }
- else
- {
- OSL_ASSERT(mrDocument.GetDocSh() != NULL);
- }
-}
-
-
-
-
-void CurrentMasterPagesSelector::Fill (ItemList& rItemList)
-{
- sal_uInt16 nPageCount = mrDocument.GetMasterSdPageCount(PK_STANDARD);
- SdPage* pMasterPage;
- // Remember the names of the master pages that have been inserted to
- // avoid double insertion.
- ::std::set<String> aMasterPageNames;
- for (sal_uInt16 nIndex=0; nIndex<nPageCount; nIndex++)
- {
- pMasterPage = mrDocument.GetMasterSdPage (nIndex, PK_STANDARD);
- if (pMasterPage == NULL)
- continue;
-
- // Use the name of the master page to avoid duplicate entries.
- OUString sName (pMasterPage->GetName());
- if (aMasterPageNames.find(sName)!=aMasterPageNames.end())
- continue;
- aMasterPageNames.insert (sName);
-
- // Look up the master page in the container and, when it is not yet
- // in it, insert it.
- MasterPageContainer::Token aToken = mpContainer->GetTokenForPageObject(pMasterPage);
- if (aToken == MasterPageContainer::NIL_TOKEN)
- {
- SharedMasterPageDescriptor pDescriptor (new MasterPageDescriptor(
- MasterPageContainer::MASTERPAGE,
- nIndex,
- OUString(),
- pMasterPage->GetName(),
- OUString(),
- pMasterPage->IsPrecious(),
- ::boost::shared_ptr<PageObjectProvider>(new ExistingPageProvider(pMasterPage)),
- ::boost::shared_ptr<PreviewProvider>(new PagePreviewProvider())));
- aToken = mpContainer->PutMasterPage(pDescriptor);
- }
-
- rItemList.push_back(aToken);
- }
-}
-
-
-
-
-ResId CurrentMasterPagesSelector::GetContextMenuResId (void) const
-{
- return SdResId(RID_TASKPANE_CURRENT_MASTERPAGESSELECTOR_POPUP);
-}
-
-
-
-
-void CurrentMasterPagesSelector::UpdateSelection (void)
-{
- // Iterate over all pages and for the selected ones put the name of
- // their master page into a set.
- sal_uInt16 nPageCount = mrDocument.GetSdPageCount(PK_STANDARD);
- SdPage* pPage;
- ::std::set<String> aNames;
- sal_uInt16 nIndex;
- bool bLoop (true);
- for (nIndex=0; nIndex<nPageCount && bLoop; nIndex++)
- {
- pPage = mrDocument.GetSdPage (nIndex, PK_STANDARD);
- if (pPage != NULL && pPage->IsSelected())
- {
- if ( ! pPage->TRG_HasMasterPage())
- {
- // One of the pages has no master page. This is an
- // indicator for that this method is called in the middle of
- // a document change and that the model is not in a valid
- // state. Therefore we stop update the selection and wait
- // for another call to UpdateSelection when the model is
- // valid again.
- bLoop = false;
- }
- else
- {
- SdrPage& rMasterPage (pPage->TRG_GetMasterPage());
- SdPage* pMasterPage = static_cast<SdPage*>(&rMasterPage);
- if (pMasterPage != NULL)
- aNames.insert (pMasterPage->GetName());
- }
- }
- }
-
- // Find the items for the master pages in the set.
- sal_uInt16 nItemCount (mpPageSet->GetItemCount());
- for (nIndex=1; nIndex<=nItemCount && bLoop; nIndex++)
- {
- OUString sName (mpPageSet->GetItemText (nIndex));
- if (aNames.find(sName) != aNames.end())
- {
- mpPageSet->SelectItem (nIndex);
- }
- }
-}
-
-
-
-
-void CurrentMasterPagesSelector::Execute (SfxRequest& rRequest)
-{
- switch (rRequest.GetSlot())
- {
- case SID_DELETE_MASTER_PAGE:
- {
- // Check once again that the master page can safely be deleted,
- // i.e. is not used.
- SdPage* pMasterPage = GetSelectedMasterPage();
- if (pMasterPage != NULL
- && mrDocument.GetMasterPageUserCount(pMasterPage) == 0)
- {
- // Removing the precious flag so that the following call to
- // RemoveUnnessesaryMasterPages() will remove this master page.
- pMasterPage->SetPrecious(false);
- mrDocument.RemoveUnnecessaryMasterPages(pMasterPage, sal_False, sal_True);
- }
- }
- break;
-
- default:
- MasterPagesSelector::Execute(rRequest);
- break;
- }
-}
-
-
-
-
-void CurrentMasterPagesSelector::GetState (SfxItemSet& rItemSet)
-{
- // Disable the SID_DELTE_MASTER slot when there is only one master page.
- if (rItemSet.GetItemState(SID_DELETE_MASTER_PAGE) == SFX_ITEM_AVAILABLE
- && mrDocument.GetMasterPageUserCount(GetSelectedMasterPage()) > 0)
- {
- rItemSet.DisableItem(SID_DELETE_MASTER_PAGE);
- }
-
- ::boost::shared_ptr<DrawViewShell> pDrawViewShell (
- ::boost::dynamic_pointer_cast<DrawViewShell>(mrBase.GetMainViewShell()));
- if (rItemSet.GetItemState(SID_TP_EDIT_MASTER) == SFX_ITEM_AVAILABLE
- && pDrawViewShell
- && pDrawViewShell->GetEditMode() == EM_MASTERPAGE)
- {
- rItemSet.DisableItem (SID_TP_EDIT_MASTER);
- }
-
- MasterPagesSelector::GetState(rItemSet);
-}
-
-
-
-
-
-
-IMPL_LINK(CurrentMasterPagesSelector,EventMultiplexerListener,
- sd::tools::EventMultiplexerEvent*,pEvent)
-{
- if (pEvent != NULL)
- {
- switch (pEvent->meEventId)
- {
- case sd::tools::EventMultiplexerEvent::EID_CURRENT_PAGE:
- case sd::tools::EventMultiplexerEvent::EID_EDIT_MODE_NORMAL:
- case sd::tools::EventMultiplexerEvent::EID_EDIT_MODE_MASTER:
- case sd::tools::EventMultiplexerEvent::EID_SLIDE_SORTER_SELECTION:
- UpdateSelection();
- break;
-
- case sd::tools::EventMultiplexerEvent::EID_PAGE_ORDER:
- // This is tricky. If a master page is removed, moved, or
- // added we have to wait until both the notes master page
- // and the standard master page have been removed, moved,
- // or added. We do this by looking at the number of master
- // pages which has to be odd in the consistent state (the
- // handout master page is always present). If the number is
- // even we ignore the hint.
- if (mrBase.GetDocument()->GetMasterPageCount()%2 == 1)
- MasterPagesSelector::Fill();
- break;
-
- case sd::tools::EventMultiplexerEvent::EID_SHAPE_CHANGED:
- case sd::tools::EventMultiplexerEvent::EID_SHAPE_INSERTED:
- case sd::tools::EventMultiplexerEvent::EID_SHAPE_REMOVED:
- InvalidatePreview((const SdPage*)pEvent->mpUserData);
- break;
- }
- }
-
- return 0;
-}
-
-
-
-
-void CurrentMasterPagesSelector::Notify (SfxBroadcaster&, const SfxHint& rHint)
-{
- const SfxSimpleHint* pSimpleHint = dynamic_cast<const SfxSimpleHint*>(&rHint);
- if (pSimpleHint != NULL)
- {
- if (pSimpleHint->GetId() == SFX_HINT_DOCCHANGED)
- {
- // Is the edit view visible in the center pane?
- ::boost::shared_ptr<DrawViewShell> pDrawViewShell (
- ::boost::dynamic_pointer_cast<DrawViewShell>(mrBase.GetMainViewShell()));
- if (pDrawViewShell.get() != NULL)
- {
- // Is the edit view in master page mode?
- if (pDrawViewShell->GetEditMode() == EM_MASTERPAGE)
- {
- // Mark the currently edited master page as precious.
- SdPage* pCurrentMasterPage = pDrawViewShell->getCurrentPage();
- if (pCurrentMasterPage != NULL)
- pCurrentMasterPage->SetPrecious(true);
- }
- }
- }
- }
-}
-
-
-
-
-} } } // end of namespace ::sd::toolpanel::controls
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/toolpanel/controls/CurrentMasterPagesSelector.hxx b/sd/source/ui/toolpanel/controls/CurrentMasterPagesSelector.hxx
deleted file mode 100644
index 5b4ee8f00c00..000000000000
--- a/sd/source/ui/toolpanel/controls/CurrentMasterPagesSelector.hxx
+++ /dev/null
@@ -1,77 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#ifndef SD_TOOLPANEL_CONTROLS_CURRENT_MASTER_PAGES_SELECTOR_HXX
-#define SD_TOOLPANEL_CONTROLS_CURRENT_MASTER_PAGES_SELECTOR_HXX
-
-#include "MasterPagesSelector.hxx"
-#include <com/sun/star/lang/XComponent.hpp>
-
-namespace sd { namespace tools { class EventMultiplexerEvent; } }
-
-
-namespace sd { namespace toolpanel { namespace controls {
-
-
-/** Show the master pages currently used by a SdDrawDocument.
-*/
-class CurrentMasterPagesSelector
- : public MasterPagesSelector,
- public SfxListener
-{
-public:
- CurrentMasterPagesSelector (
- TreeNode* pParent,
- SdDrawDocument& rDocument,
- ViewShellBase& rBase,
- const ::boost::shared_ptr<MasterPageContainer>& rpContainer);
- virtual ~CurrentMasterPagesSelector (void);
-
- virtual void LateInit (void);
-
- /** Set the selection so that the master page is selected that is
- used by the currently selected page of the document in the
- center pane.
- */
- virtual void UpdateSelection (void);
-
- /** Copy all master pages that are to be shown into the given list.
- */
- virtual void Fill (ItemList& rItemList);
-
- using sd::toolpanel::controls::MasterPagesSelector::Fill;
-
-protected:
- virtual ResId GetContextMenuResId (void) const;
- virtual void Execute (SfxRequest& rRequest);
- virtual void GetState (SfxItemSet& rItemSet);
-
-private:
- ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent>
- mxListener;
-
- DECL_LINK(EventMultiplexerListener,sd::tools::EventMultiplexerEvent*);
- void Notify (SfxBroadcaster&, const SfxHint& rHint);
-};
-
-} } } // end of namespace ::sd::toolpanel::controls
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/toolpanel/controls/CustomAnimationPanel.cxx b/sd/source/ui/toolpanel/controls/CustomAnimationPanel.cxx
deleted file mode 100644
index d090708c0577..000000000000
--- a/sd/source/ui/toolpanel/controls/CustomAnimationPanel.cxx
+++ /dev/null
@@ -1,106 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-
-#include "CustomAnimationPanel.hxx"
-
-#include "taskpane/TaskPaneControlFactory.hxx"
-#include "taskpane/ToolPanelViewShell.hxx"
-
-#include "strings.hrc"
-#include "sdresid.hxx"
-
-namespace sd
-{
-
- class ViewShellBase;
- extern ::Window * createCustomAnimationPanel( ::Window* pParent, ViewShellBase& rBase,
- const cssu::Reference<css::frame::XFrame>& rxFrame );
-
-namespace toolpanel { namespace controls {
-
-
-CustomAnimationPanel::CustomAnimationPanel(Window& i_rParentWindow, ToolPanelViewShell& i_rPanelViewShell)
- :SubToolPanel( i_rParentWindow )
- ,m_pPanelViewShell( &i_rPanelViewShell )
-{
- mpWrappedControl = createCustomAnimationPanel( &i_rParentWindow, i_rPanelViewShell.GetViewShellBase(), NULL );
- mpWrappedControl->Show();
-}
-
-CustomAnimationPanel::~CustomAnimationPanel()
-{
- delete mpWrappedControl;
-}
-
-std::auto_ptr< ControlFactory > CustomAnimationPanel::CreateControlFactory( ToolPanelViewShell& i_rToolPanelShell )
-{
- return std::auto_ptr< ControlFactory >(
- new RootControlFactoryWithArg< CustomAnimationPanel, ToolPanelViewShell >( i_rToolPanelShell ) );
-}
-
-TaskPaneShellManager* CustomAnimationPanel::GetShellManager()
-{
- if ( m_pPanelViewShell )
- return &m_pPanelViewShell->GetSubShellManager();
- return SubToolPanel::GetShellManager();
-}
-
-Size CustomAnimationPanel::GetPreferredSize()
-{
- return maPreferredSize;
-}
-sal_Int32 CustomAnimationPanel::GetPreferredWidth(sal_Int32 )
-{
- return maPreferredSize.Width();
-}
-sal_Int32 CustomAnimationPanel::GetPreferredHeight(sal_Int32 )
-{
- return maPreferredSize.Height();
-}
-::Window* CustomAnimationPanel::GetWindow()
-{
- return mpWrappedControl;
-}
-bool CustomAnimationPanel::IsResizable()
-{
- return true;
-}
-bool CustomAnimationPanel::IsExpandable() const
-{
- return true;
-}
-
-
-
-
-::com::sun::star::uno::Reference<
- ::com::sun::star::accessibility::XAccessible> CustomAnimationPanel::CreateAccessibleObject (
- const ::com::sun::star::uno::Reference<
- ::com::sun::star::accessibility::XAccessible>& )
-{
- if (GetWindow() != NULL)
- return GetWindow()->GetAccessible();
- else
- return NULL;
-}
-
-} } } // end of namespace ::sd::toolpanel::controls
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/toolpanel/controls/CustomAnimationPanel.hxx b/sd/source/ui/toolpanel/controls/CustomAnimationPanel.hxx
deleted file mode 100644
index cb47272a1fab..000000000000
--- a/sd/source/ui/toolpanel/controls/CustomAnimationPanel.hxx
+++ /dev/null
@@ -1,71 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#ifndef SD_TOOLPANEL_CONTROLS_CUSTOM_ANIMATION_PANEL_HXX
-#define SD_TOOLPANEL_CONTROLS_CUSTOM_ANIMATION_PANEL_HXX
-
-#include "taskpane/SubToolPanel.hxx"
-
-namespace sd { namespace toolpanel {
-class TreeNode;
-class ControlFactory;
-class ToolPanelViewShell;
-} }
-
-namespace sd { namespace toolpanel { namespace controls {
-
-class CustomAnimationPanel
- : public SubToolPanel
-{
-public:
- CustomAnimationPanel (
- Window& i_rParentWindow,
- ToolPanelViewShell& i_rPanelViewShell);
- virtual ~CustomAnimationPanel (void);
-
- static std::auto_ptr<ControlFactory> CreateControlFactory (ToolPanelViewShell& i_rPanelViewShell);
-
- // TreeNode overridables
- virtual TaskPaneShellManager* GetShellManager();
-
- // ILayoutableWindow overridables
- virtual Size GetPreferredSize (void);
- virtual sal_Int32 GetPreferredWidth (sal_Int32 nHeigh);
- virtual sal_Int32 GetPreferredHeight (sal_Int32 nWidth);
- virtual ::Window* GetWindow (void);
- virtual bool IsResizable (void);
- virtual bool IsExpandable (void) const;
-
- virtual ::com::sun::star::uno::Reference<
- ::com::sun::star::accessibility::XAccessible > CreateAccessibleObject (
- const ::com::sun::star::uno::Reference<
- ::com::sun::star::accessibility::XAccessible>& rxParent);
-
- using Window::GetWindow;
-private:
- Size maPreferredSize;
- ::Window* mpWrappedControl;
- ToolPanelViewShell* m_pPanelViewShell;
-};
-
-} } } // end of namespace ::sd::toolpanel::controls
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/toolpanel/controls/DocumentHelper.cxx b/sd/source/ui/toolpanel/controls/DocumentHelper.cxx
deleted file mode 100644
index ff8dcb24c4bc..000000000000
--- a/sd/source/ui/toolpanel/controls/DocumentHelper.cxx
+++ /dev/null
@@ -1,575 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-
-#include "DocumentHelper.hxx"
-
-#include "drawdoc.hxx"
-#include "DrawDocShell.hxx"
-#include "sdpage.hxx"
-#include "glob.hxx"
-#include "unmovss.hxx"
-#include "strings.hrc"
-#include "sdresid.hxx"
-#include "undoback.hxx"
-#include <com/sun/star/drawing/XDrawPagesSupplier.hpp>
-#include <com/sun/star/drawing/XDrawPages.hpp>
-#include <com/sun/star/frame/XComponentLoader.hpp>
-#include <com/sun/star/container/XIndexAccess.hpp>
-#include "stlpool.hxx"
-#include <svx/xfillit0.hxx>
-#include <tools/diagnose_ex.h>
-
-using namespace ::com::sun::star;
-
-namespace sd { namespace toolpanel { namespace controls {
-
-SdPage* DocumentHelper::CopyMasterPageToLocalDocument (
- SdDrawDocument& rTargetDocument,
- SdPage* pMasterPage)
-{
- SdPage* pNewMasterPage = NULL;
-
- do
- {
- if (pMasterPage == NULL)
- break;
-
- // Check the presence of the source document.
- SdDrawDocument* pSourceDocument = static_cast<SdDrawDocument*>(
- pMasterPage->GetModel());
- if (pSourceDocument == NULL)
- break;
-
- // When the given master page already belongs to the target document
- // then there is nothing more to do.
- if (pSourceDocument == &rTargetDocument)
- {
- pNewMasterPage = pMasterPage;
- break;
- }
-
- // Test if the master pages of both the slide and its notes page are
- // present. This is not the case when we are called during the
- // creation of the slide master page because then the notes master
- // page is not there.
- sal_uInt16 nSourceMasterPageCount = pSourceDocument->GetMasterPageCount();
- if (nSourceMasterPageCount%2 == 0)
- // There should be 1 handout page + n slide masters + n notes
- // masters = 2*n+1. An even value indicates that a new slide
- // master but not yet the notes master has been inserted.
- break;
- sal_uInt16 nIndex = pMasterPage->GetPageNum();
- if (nSourceMasterPageCount <= nIndex+1)
- break;
- // Get the slide master page.
- if (pMasterPage != static_cast<SdPage*>(
- pSourceDocument->GetMasterPage(nIndex)))
- break;
- // Get the notes master page.
- SdPage* pNotesMasterPage = static_cast<SdPage*>(
- pSourceDocument->GetMasterPage(nIndex+1));
- if (pNotesMasterPage == NULL)
- break;
-
-
- // Check if a master page with the same name as that of the given
- // master page already exists.
- bool bPageExists (false);
- sal_uInt16 nMasterPageCount(rTargetDocument.GetMasterSdPageCount(PK_STANDARD));
- for (sal_uInt16 nMaster=0; nMaster<nMasterPageCount; nMaster++)
- {
- SdPage* pCandidate = static_cast<SdPage*>(
- rTargetDocument.GetMasterSdPage (nMaster, PK_STANDARD));
- if (pMasterPage!=NULL
- && pCandidate->GetName() == pMasterPage->GetName())
- {
- bPageExists = true;
- pNewMasterPage = pCandidate;
- break;
- }
- }
- if (bPageExists)
- break;
-
- // Create a new slide (and its notes page.)
- uno::Reference<drawing::XDrawPagesSupplier> xSlideSupplier (
- rTargetDocument.getUnoModel(), uno::UNO_QUERY);
- if ( ! xSlideSupplier.is())
- break;
- uno::Reference<drawing::XDrawPages> xSlides (
- xSlideSupplier->getDrawPages(), uno::UNO_QUERY);
- if ( ! xSlides.is())
- break;
- xSlides->insertNewByIndex (xSlides->getCount());
-
- // Set a layout.
- SdPage* pSlide = rTargetDocument.GetSdPage(
- rTargetDocument.GetSdPageCount(PK_STANDARD)-1,
- PK_STANDARD);
- if (pSlide == NULL)
- break;
- pSlide->SetAutoLayout(AUTOLAYOUT_TITLE, sal_True);
-
- // Create a copy of the master page and the associated notes
- // master page and insert them into our document.
- pNewMasterPage = AddMasterPage(rTargetDocument, pMasterPage);
- if (pNewMasterPage==NULL)
- break;
- SdPage* pNewNotesMasterPage
- = AddMasterPage(rTargetDocument, pNotesMasterPage);
- if (pNewNotesMasterPage==NULL)
- break;
-
- // Make the connection from the new slide to the master page
- // (and do the same for the notes page.)
- rTargetDocument.SetMasterPage (
- rTargetDocument.GetSdPageCount(PK_STANDARD)-1,
- pNewMasterPage->GetName(),
- &rTargetDocument,
- sal_False, // Connect the new master page with the new slide but
- // do not modify other (master) pages.
- sal_True);
- }
- while (false);
-
- // We are not interested in any automatisms for our modified internal
- // document.
- rTargetDocument.SetChanged (sal_False);
-
- return pNewMasterPage;
-}
-
-
-
-
-SdPage* DocumentHelper::GetSlideForMasterPage (SdPage* pMasterPage)
-{
- SdPage* pCandidate = NULL;
-
- SdDrawDocument* pDocument = NULL;
- if (pMasterPage != NULL)
- pDocument = dynamic_cast<SdDrawDocument*>(pMasterPage->GetModel());
-
- // Iterate over all pages and check if it references the given master
- // page.
- if (pDocument!=NULL && pDocument->GetSdPageCount(PK_STANDARD) > 0)
- {
- // In most cases a new slide has just been inserted so start with
- // the last page.
- sal_uInt16 nPageIndex (pDocument->GetSdPageCount(PK_STANDARD)-1);
- bool bFound (false);
- while ( ! bFound)
- {
- pCandidate = pDocument->GetSdPage(
- nPageIndex,
- PK_STANDARD);
- if (pCandidate != NULL)
- {
- if (static_cast<SdPage*>(&pCandidate->TRG_GetMasterPage())
- == pMasterPage)
- {
- bFound = true;
- break;
- }
- }
-
- if (nPageIndex == 0)
- break;
- else
- nPageIndex --;
- }
-
- // If no page was found that refernced the given master page reset
- // the pointer that is returned.
- if ( ! bFound)
- pCandidate = NULL;
- }
-
- return pCandidate;
-}
-
-
-
-
-SdPage* DocumentHelper::AddMasterPage (
- SdDrawDocument& rTargetDocument,
- SdPage* pMasterPage)
-{
- SdPage* pClonedMasterPage = NULL;
-
- if (pMasterPage!=NULL)
- {
- try
- {
- // Duplicate the master page.
- pClonedMasterPage = static_cast<SdPage*>(pMasterPage->Clone());
-
- // Copy the necessary styles.
- SdDrawDocument* pSourceDocument
- = static_cast<SdDrawDocument*>(pMasterPage->GetModel());
- if (pSourceDocument != NULL)
- ProvideStyles (*pSourceDocument, rTargetDocument, pClonedMasterPage);
-
- // Copy the precious flag.
- pClonedMasterPage->SetPrecious(pMasterPage->IsPrecious());
-
- // Now that the styles are available we can insert the cloned
- // master page.
- rTargetDocument.InsertMasterPage (pClonedMasterPage);
- }
- catch(const uno::Exception&)
- {
- pClonedMasterPage = NULL;
- DBG_UNHANDLED_EXCEPTION();
- }
- catch(const ::std::exception&)
- {
- pClonedMasterPage = NULL;
- OSL_TRACE ("caught general exception");
- }
- catch(...)
- {
- pClonedMasterPage = NULL;
- OSL_TRACE ("caught general exception");
- }
- }
-
- return pClonedMasterPage;
-}
-
-
-
-
-void DocumentHelper::ProvideStyles (
- SdDrawDocument& rSourceDocument,
- SdDrawDocument& rTargetDocument,
- SdPage* pPage)
-{
- // Get the layout name of the given page.
- OUString sLayoutName (pPage->GetLayoutName());
- sal_Int32 nIndex = sLayoutName.indexOf(SD_LT_SEPARATOR);
- if( nIndex != -1 )
- sLayoutName = sLayoutName.copy(0, nIndex);
-
- // Copy the style sheet from source to target document.
- SdStyleSheetPool* pSourceStyleSheetPool =
- static_cast<SdStyleSheetPool*>(rSourceDocument.GetStyleSheetPool());
- SdStyleSheetPool* pTargetStyleSheetPool =
- static_cast<SdStyleSheetPool*>(rTargetDocument.GetStyleSheetPool());
- SdStyleSheetVector aCreatedStyles;
- pTargetStyleSheetPool->CopyLayoutSheets (
- sLayoutName,
- *pSourceStyleSheetPool,
- aCreatedStyles);
-
- // Add an undo action for the copied style sheets.
- if( !aCreatedStyles.empty() )
- {
- ::svl::IUndoManager* pUndoManager = rTargetDocument.GetDocSh()->GetUndoManager();
- if (pUndoManager != NULL)
- {
- SdMoveStyleSheetsUndoAction* pMovStyles =
- new SdMoveStyleSheetsUndoAction (
- &rTargetDocument,
- aCreatedStyles,
- sal_True);
- pUndoManager->AddUndoAction (pMovStyles);
- }
- }
-}
-
-
-
-
-void DocumentHelper::AssignMasterPageToPageList (
- SdDrawDocument& rTargetDocument,
- SdPage* pMasterPage,
- const ::boost::shared_ptr<std::vector<SdPage*> >& rpPageList)
-{
- if (pMasterPage == NULL || !pMasterPage->IsMasterPage())
- return;
-
- // Make the layout name by stripping ouf the layout postfix from the
- // layout name of the given master page.
- OUString sFullLayoutName(pMasterPage->GetLayoutName());
- OUString sBaseLayoutName (sFullLayoutName);
- sal_Int32 nIndex = sBaseLayoutName.indexOf(SD_LT_SEPARATOR);
- if( nIndex != -1 )
- sBaseLayoutName = sBaseLayoutName.copy(0, nIndex);
-
- if (rpPageList->empty())
- return;
-
- // Create a second list that contains only the valid pointers to
- // pages for which an assignment is necessary.
- ::std::vector<SdPage*>::const_iterator iPage;
- ::std::vector<SdPage*> aCleanedList;
- for (iPage=rpPageList->begin(); iPage!=rpPageList->end(); ++iPage)
- {
- OSL_ASSERT(*iPage!=NULL && (*iPage)->GetModel() == &rTargetDocument);
- if (*iPage != NULL && (*iPage)->GetLayoutName() != sFullLayoutName)
- {
- aCleanedList.push_back(*iPage);
- }
- }
- if (aCleanedList.empty() )
- return;
-
- ::svl::IUndoManager* pUndoMgr = rTargetDocument.GetDocSh()->GetUndoManager();
- if( pUndoMgr )
- pUndoMgr->EnterListAction(SD_RESSTR(STR_UNDO_SET_PRESLAYOUT), OUString());
-
- SdPage* pMasterPageInDocument = ProvideMasterPage(rTargetDocument,pMasterPage,rpPageList);
- if (pMasterPageInDocument == NULL)
- return;
-
- // Assign the master pages to the given list of pages.
- for (iPage=aCleanedList.begin();
- iPage!=aCleanedList.end();
- ++iPage)
- {
- AssignMasterPageToPage (
- pMasterPageInDocument,
- sBaseLayoutName,
- *iPage);
- }
-
- if( pUndoMgr )
- pUndoMgr->LeaveListAction();
-}
-
-
-
-
-SdPage* DocumentHelper::AddMasterPage (
- SdDrawDocument& rTargetDocument,
- SdPage* pMasterPage,
- sal_uInt16 nInsertionIndex)
-{
- SdPage* pClonedMasterPage = NULL;
-
- if (pMasterPage!=NULL)
- {
- // Duplicate the master page.
- pClonedMasterPage = static_cast<SdPage*>(pMasterPage->Clone());
-
- // Copy the precious flag.
- pClonedMasterPage->SetPrecious(pMasterPage->IsPrecious());
-
- // Copy the necessary styles.
- SdDrawDocument* pSourceDocument
- = static_cast<SdDrawDocument*>(pMasterPage->GetModel());
- if (pSourceDocument != NULL)
- {
- ProvideStyles (*pSourceDocument, rTargetDocument, pClonedMasterPage);
-
- // Now that the styles are available we can insert the cloned
- // master page.
- rTargetDocument.InsertMasterPage (pClonedMasterPage, nInsertionIndex);
-
- // Adapt the size of the new master page to that of the pages in
- // the document.
- Size aNewSize (rTargetDocument.GetSdPage(0, pMasterPage->GetPageKind())->GetSize());
- Rectangle aBorders (
- pClonedMasterPage->GetLftBorder(),
- pClonedMasterPage->GetUppBorder(),
- pClonedMasterPage->GetRgtBorder(),
- pClonedMasterPage->GetLwrBorder());
- pClonedMasterPage->ScaleObjects(aNewSize, aBorders, sal_True);
- pClonedMasterPage->SetSize(aNewSize);
- pClonedMasterPage->CreateTitleAndLayout(sal_True);
- }
- }
-
- return pClonedMasterPage;
-}
-
-
-
-
-/** In here we have to handle three cases:
- 1. pPage is a normal slide. We can use SetMasterPage to assign the
- master pages to it.
- 2. pPage is a master page that is used by at least one slide. We can
- assign the master page to these slides.
- 3. pPage is a master page that is currently not used by any slide.
- We can delete that page and add copies of the given master pages
- instead.
-
- For points 2 and 3 where one master page A is assigned to another B we have
- to keep in mind that the master page that page A has already been
- inserted into the target document.
-*/
-void DocumentHelper::AssignMasterPageToPage (
- SdPage* pMasterPage,
- const OUString& rsBaseLayoutName,
- SdPage* pPage)
-{
- // Leave early when the parameters are invalid.
- if (pPage == NULL || pMasterPage == NULL)
- return;
- SdDrawDocument* pDocument = dynamic_cast<SdDrawDocument*>(pPage->GetModel());
- if (pDocument == NULL)
- return;
-
- if ( ! pPage->IsMasterPage())
- {
- // 1. Remove the background object (so that that, if it exists, does
- // not override the new master page) and assign the master page to
- // the regular slide.
- pDocument->GetDocSh()->GetUndoManager()->AddUndoAction(
- new SdBackgroundObjUndoAction(
- *pDocument, *pPage, pPage->getSdrPageProperties().GetItemSet()),
- sal_True);
- pPage->getSdrPageProperties().PutItem(XFillStyleItem(XFILL_NONE));
-
- pDocument->SetMasterPage (
- (pPage->GetPageNum()-1)/2,
- rsBaseLayoutName,
- pDocument,
- sal_False,
- sal_False);
- }
- else
- {
- // Find first slide that uses the master page.
- SdPage* pSlide = NULL;
- sal_uInt16 nPageCount = pDocument->GetSdPageCount(PK_STANDARD);
- for (sal_uInt16 nPage=0; nPage<nPageCount&&pSlide==NULL; nPage++)
- {
- SdrPage* pCandidate = pDocument->GetSdPage(nPage,PK_STANDARD);
- if (pCandidate != NULL
- && pCandidate->TRG_HasMasterPage()
- && &(pCandidate->TRG_GetMasterPage()) == pPage)
- {
- pSlide = static_cast<SdPage*>(pCandidate);
- }
- }
-
- if (pSlide != NULL)
- {
- // 2. Assign the given master pages to the first slide that was
- // found above that uses the master page.
- pDocument->SetMasterPage (
- (pSlide->GetPageNum()-1)/2,
- rsBaseLayoutName,
- pDocument,
- sal_False,
- sal_False);
- }
- else
- {
- // 3. Replace the master page A by a copy of the given master
- // page B.
- pDocument->RemoveUnnecessaryMasterPages (
- pPage, sal_False);
- }
- }
-}
-
-
-
-
-SdPage* DocumentHelper::ProvideMasterPage (
- SdDrawDocument& rTargetDocument,
- SdPage* pMasterPage,
- const ::boost::shared_ptr<std::vector<SdPage*> >& rpPageList)
-{
- // Make sure that both the master page and its notes master exist
- // in the source document. If one is missing then return without
- // making any changes.
- if (pMasterPage == NULL)
- {
- // The caller should make sure that the master page is valid.
- OSL_ASSERT(pMasterPage != NULL);
- return NULL;
- }
- SdDrawDocument* pSourceDocument = static_cast<SdDrawDocument*>(pMasterPage->GetModel());
- if (pSourceDocument == NULL)
- return NULL;
- SdPage* pNotesMasterPage = static_cast<SdPage*>(
- pSourceDocument->GetMasterPage(pMasterPage->GetPageNum()+1));
- if (pNotesMasterPage == NULL)
- {
- // The model is not in a valid state. Maybe a new master page
- // is being (not finished yet) created? Return without making
- // any changes.
- return NULL;
- }
-
- SdPage* pMasterPageInDocument = NULL;
- // Search for a master page with the same name as the given one in
- // the target document.
- const OUString sMasterPageLayoutName (pMasterPage->GetLayoutName());
- for (sal_uInt16 nIndex=0,nCount=rTargetDocument.GetMasterPageCount(); nIndex<nCount; ++nIndex)
- {
- SdPage* pCandidate = static_cast<SdPage*>(rTargetDocument.GetMasterPage(nIndex));
- if (pCandidate && sMasterPageLayoutName.equals(pCandidate->GetLayoutName()))
- {
- // The requested master page does already exist in the
- // target document, return it.
- return pCandidate;
- }
- }
-
- // The given master page does not already belong to the target
- // document so we have to create copies and insert them into the
- // targer document.
-
- // Determine the position where the new master pages are inserted.
- // By default they are inserted at the end. When we assign to a
- // master page then insert after the last of the (selected) pages.
- sal_uInt16 nInsertionIndex = rTargetDocument.GetMasterPageCount();
- if (rpPageList->front()->IsMasterPage())
- {
- nInsertionIndex = rpPageList->back()->GetPageNum();
- }
-
- // Clone the master page.
- if (pMasterPage->GetModel() != &rTargetDocument)
- {
- pMasterPageInDocument = AddMasterPage (rTargetDocument, pMasterPage, nInsertionIndex);
- if( rTargetDocument.IsUndoEnabled() )
- rTargetDocument.AddUndo(
- rTargetDocument.GetSdrUndoFactory().CreateUndoNewPage(*pMasterPageInDocument));
- }
- else
- pMasterPageInDocument = pMasterPage;
-
- // Clone the notes master.
- if (pNotesMasterPage->GetModel() != &rTargetDocument)
- {
- SdPage* pClonedNotesMasterPage
- = AddMasterPage (rTargetDocument, pNotesMasterPage, nInsertionIndex+1);
- if( rTargetDocument.IsUndoEnabled() )
- rTargetDocument.AddUndo(
- rTargetDocument.GetSdrUndoFactory().CreateUndoNewPage(*pClonedNotesMasterPage));
- }
-
- return pMasterPageInDocument;
-}
-
-
-
-
-
-} } } // end of namespace ::sd::toolpanel::controls
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/toolpanel/controls/DocumentHelper.hxx b/sd/source/ui/toolpanel/controls/DocumentHelper.hxx
deleted file mode 100644
index 6f2820140dc7..000000000000
--- a/sd/source/ui/toolpanel/controls/DocumentHelper.hxx
+++ /dev/null
@@ -1,110 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#ifndef SD_TOOLPANEL_CONTROLS_DCUMENT_HELPER_HXX
-#define SD_TOOLPANEL_CONTROLS_DCUMENT_HELPER_HXX
-
-#include <rtl/ustring.hxx>
-#include <tools/solar.h>
-#include <boost/shared_ptr.hpp>
-#include <vector>
-
-class SdDrawDocument;
-class SdPage;
-
-namespace sd { namespace toolpanel { namespace controls {
-
-/** A collection of methods supporting the handling of master pages.
-*/
-class DocumentHelper
-{
-public:
- /** Return a copy of the given master page in the given document.
- */
- static SdPage* CopyMasterPageToLocalDocument (
- SdDrawDocument& rTargetDocument,
- SdPage* pMasterPage);
-
- /** Return and, when not yet present, create a slide that uses the given
- masster page.
- */
- static SdPage* GetSlideForMasterPage (SdPage* pMasterPage);
-
- /** Copy the styles used by the given page from the source document to
- the target document.
- */
- static void ProvideStyles (
- SdDrawDocument& rSourceDocument,
- SdDrawDocument& rTargetDocument,
- SdPage* pPage);
-
- /** Assign the given master page to the list of pages.
- @param rTargetDocument
- The document that is the owner of the pages in rPageList.
- @param pMasterPage
- This master page will usually be a member of the list of all
- available master pages as provided by the MasterPageContainer.
- @param rPageList
- The pages to which to assign the master page. These pages may
- be slides or master pages themselves.
- */
- static void AssignMasterPageToPageList (
- SdDrawDocument& rTargetDocument,
- SdPage* pMasterPage,
- const ::boost::shared_ptr<std::vector<SdPage*> >& rPageList);
-
-private:
- static SdPage* AddMasterPage (
- SdDrawDocument& rTargetDocument,
- SdPage* pMasterPage);
- static SdPage* AddMasterPage (
- SdDrawDocument& rTargetDocument,
- SdPage* pMasterPage,
- sal_uInt16 nInsertionIndex);
- static SdPage* ProvideMasterPage (
- SdDrawDocument& rTargetDocument,
- SdPage* pMasterPage,
- const ::boost::shared_ptr<std::vector<SdPage*> >& rpPageList);
-
- /** Assign the given master page to the given page.
- @param pMasterPage
- In contrast to AssignMasterPageToPageList() this page is assumed
- to be in the target document, i.e. the same document that pPage
- is in. The caller will usually call AddMasterPage() to create a
- clone of a master page in a another document to create it.
- @param rsBaseLayoutName
- The layout name of the given master page. It is given so that
- it has not to be created on every call. It could be generated
- from the given master page, though.
- @param pPage
- The page to which to assign the master page. It can be a slide
- or a master page itself.
- */
- static void AssignMasterPageToPage (
- SdPage* pMasterPage,
- const OUString& rsBaseLayoutName,
- SdPage* pPage);
-};
-
-
-} } } // end of namespace ::sd::toolpanel::controls
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/toolpanel/controls/MasterPageContainer.cxx b/sd/source/ui/toolpanel/controls/MasterPageContainer.cxx
deleted file mode 100644
index 21c18474f621..000000000000
--- a/sd/source/ui/toolpanel/controls/MasterPageContainer.cxx
+++ /dev/null
@@ -1,1208 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-
-#include "MasterPageContainer.hxx"
-
-#include "MasterPageDescriptor.hxx"
-#include "MasterPageContainerFiller.hxx"
-#include "MasterPageContainerQueue.hxx"
-#include "TemplateScanner.hxx"
-#include "tools/AsynchronousTask.hxx"
-#include "strings.hrc"
-#include <algorithm>
-#include <list>
-#include <set>
-
-#include "unomodel.hxx"
-#include <com/sun/star/frame/Desktop.hpp>
-#include <com/sun/star/frame/XComponentLoader.hpp>
-#include <com/sun/star/io/XStream.hpp>
-#include <com/sun/star/io/XInputStream.hpp>
-#include <com/sun/star/lang/XSingleServiceFactory.hpp>
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-#include <com/sun/star/uno/Reference.hxx>
-#include <com/sun/star/uno/Any.hxx>
-#include <com/sun/star/uno/Sequence.hxx>
-#include <com/sun/star/util/XCloseable.hpp>
-#include <comphelper/processfactory.hxx>
-#include <sfx2/app.hxx>
-#include <svx/svdpage.hxx>
-#include "DrawDocShell.hxx"
-#include "drawdoc.hxx"
-#include "sdpage.hxx"
-#include <svl/itemset.hxx>
-#include <svl/eitem.hxx>
-#include "sdresid.hxx"
-#include "tools/TimerBasedTaskExecution.hxx"
-#include "pres.hxx"
-#include <osl/mutex.hxx>
-#include <boost/weak_ptr.hpp>
-
-using namespace ::com::sun::star;
-using namespace ::com::sun::star::uno;
-using namespace ::sd::toolpanel::controls;
-
-namespace {
-
-typedef ::std::vector<SharedMasterPageDescriptor> MasterPageContainerType;
-
-} // end of anonymous namespace
-
-
-namespace sd { namespace toolpanel { namespace controls {
-
-
-/** Inner implementation class of the MasterPageContainer.
-*/
-class MasterPageContainer::Implementation
- : public SdGlobalResource,
- public MasterPageContainerFiller::ContainerAdapter,
- public MasterPageContainerQueue::ContainerAdapter
-{
-public:
- mutable ::osl::Mutex maMutex;
-
- static ::boost::weak_ptr<Implementation> mpInstance;
- MasterPageContainerType maContainer;
-
- static ::boost::shared_ptr<Implementation> Instance (void);
-
- void LateInit (void);
- void AddChangeListener (const Link& rLink);
- void RemoveChangeListener (const Link& rLink);
- void UpdatePreviewSizePixel (void);
- Size GetPreviewSizePixel (PreviewSize eSize) const;
-
- bool HasToken (Token aToken) const;
- const SharedMasterPageDescriptor GetDescriptor (MasterPageContainer::Token aToken) const;
- SharedMasterPageDescriptor GetDescriptor (MasterPageContainer::Token aToken);
- virtual Token PutMasterPage (const SharedMasterPageDescriptor& rDescriptor);
- void InvalidatePreview (Token aToken);
- Image GetPreviewForToken (
- Token aToken,
- PreviewSize ePreviewSize);
- PreviewState GetPreviewState (Token aToken) const;
- bool RequestPreview (Token aToken);
-
- Reference<frame::XModel> GetModel (void);
- SdDrawDocument* GetDocument (void);
-
- void FireContainerChange (
- MasterPageContainerChangeEvent::EventType eType,
- Token aToken,
- bool bNotifyAsynchronously = false);
-
- virtual bool UpdateDescriptor (
- const SharedMasterPageDescriptor& rpDescriptor,
- bool bForcePageObject,
- bool bForcePreview,
- bool bSendEvents);
-
- void ReleaseDescriptor (Token aToken);
-
- /** Called by the MasterPageContainerFiller to notify that all master
- pages from template documents have been added.
- */
- virtual void FillingDone (void);
-
-private:
- Implementation (void);
- virtual ~Implementation (void);
-
- class Deleter { public:
- void operator() (Implementation* pObject) { delete pObject; }
- };
- friend class Deleter;
-
- enum InitializationState { NOT_INITIALIZED, INITIALIZING, INITIALIZED } meInitializationState;
-
- ::boost::scoped_ptr<MasterPageContainerQueue> mpRequestQueue;
- ::com::sun::star::uno::Reference<com::sun::star::frame::XModel> mxModel;
- SdDrawDocument* mpDocument;
- PreviewRenderer maPreviewRenderer;
- /** Remember whether the first page object has already been used to
- determine the correct size ratio.
- */
- bool mbFirstPageObjectSeen;
-
- // The widths for the previews contain two pixels for the border that is
- // painted arround the preview.
- static const int SMALL_PREVIEW_WIDTH = 72 + 2;
- static const int LARGE_PREVIEW_WIDTH = 2*72 + 2;
-
- /** This substition of page preview shows "Preparing preview" and is
- shown as long as the actual previews are not being present.
- */
- Image maLargePreviewBeingCreated;
- Image maSmallPreviewBeingCreated;
-
- /** This substition of page preview is shown when a preview can not be
- created and thus is not available.
- */
- Image maLargePreviewNotAvailable;
- Image maSmallPreviewNotAvailable;
-
- ::std::vector<Link> maChangeListeners;
-
- // We have to remember the tasks for initialization and filling in case
- // a MasterPageContainer object is destroyed before these tasks have
- // been completed.
- ::boost::weak_ptr<sd::tools::TimerBasedTaskExecution> mpFillerTask;
-
- Size maSmallPreviewSizePixel;
- Size maLargePreviewSizePixel;
-
- bool mbContainerCleaningPending;
-
- typedef ::std::pair<MasterPageContainerChangeEvent::EventType,Token> EventData;
- DECL_LINK(AsynchronousNotifyCallback, EventData*);
-
- Image GetPreviewSubstitution (sal_uInt16 nId, PreviewSize ePreviewSize);
-
- void CleanContainer (void);
-};
-
-
-
-
-//===== MasterPageContainer ===================================================
-
-::boost::weak_ptr<MasterPageContainer::Implementation>
- MasterPageContainer::Implementation::mpInstance;
-static const MasterPageContainer::Token NIL_TOKEN (-1);
-
-
-
-
-::boost::shared_ptr<MasterPageContainer::Implementation>
- MasterPageContainer::Implementation::Instance (void)
-{
- ::boost::shared_ptr<MasterPageContainer::Implementation> pInstance;
-
- if (Implementation::mpInstance.expired())
- {
- ::osl::GetGlobalMutex aMutexFunctor;
- ::osl::MutexGuard aGuard (aMutexFunctor());
- if (Implementation::mpInstance.expired())
- {
- OSL_DOUBLE_CHECKED_LOCKING_MEMORY_BARRIER();
- pInstance = ::boost::shared_ptr<MasterPageContainer::Implementation>(
- new MasterPageContainer::Implementation(),
- MasterPageContainer::Implementation::Deleter());
- SdGlobalResourceContainer::Instance().AddResource(pInstance);
- Implementation::mpInstance = pInstance;
- }
- else
- pInstance = ::boost::shared_ptr<MasterPageContainer::Implementation>(
- Implementation::mpInstance);
- }
- else
- {
- OSL_DOUBLE_CHECKED_LOCKING_MEMORY_BARRIER();
- pInstance = ::boost::shared_ptr<MasterPageContainer::Implementation>(
- Implementation::mpInstance);
- }
-
- DBG_ASSERT (pInstance.get()!=NULL,
- "MasterPageContainer::Implementation::Instance(): instance is NULL");
- return pInstance;
-}
-
-
-
-
-MasterPageContainer::MasterPageContainer (void)
- : mpImpl(Implementation::Instance()),
- mePreviewSize(SMALL)
-{
- mpImpl->LateInit();
-}
-
-
-
-
-MasterPageContainer::~MasterPageContainer (void)
-{
-}
-
-
-
-
-void MasterPageContainer::AddChangeListener (const Link& rLink)
-{
- mpImpl->AddChangeListener(rLink);
-}
-
-
-
-
-void MasterPageContainer::RemoveChangeListener (const Link& rLink)
-{
- mpImpl->RemoveChangeListener(rLink);
-}
-
-
-
-
-void MasterPageContainer::SetPreviewSize (PreviewSize eSize)
-{
- mePreviewSize = eSize;
- mpImpl->FireContainerChange(
- MasterPageContainerChangeEvent::SIZE_CHANGED,
- NIL_TOKEN);
-}
-
-
-
-
-MasterPageContainer::PreviewSize MasterPageContainer::GetPreviewSize (void) const
-{
- return mePreviewSize;
-}
-
-
-
-
-Size MasterPageContainer::GetPreviewSizePixel (void) const
-{
- return mpImpl->GetPreviewSizePixel(mePreviewSize);
-}
-
-
-
-
-MasterPageContainer::Token MasterPageContainer::PutMasterPage (
- const SharedMasterPageDescriptor& rDescriptor)
-{
- return mpImpl->PutMasterPage(rDescriptor);
-}
-
-
-
-
-void MasterPageContainer::AcquireToken (Token aToken)
-{
- SharedMasterPageDescriptor pDescriptor = mpImpl->GetDescriptor(aToken);
- if (pDescriptor.get() != NULL)
- {
- ++pDescriptor->mnUseCount;
- }
-}
-
-
-
-
-void MasterPageContainer::ReleaseToken (Token aToken)
-{
- SharedMasterPageDescriptor pDescriptor = mpImpl->GetDescriptor(aToken);
- if (pDescriptor.get() != NULL)
- {
- OSL_ASSERT(pDescriptor->mnUseCount>0);
- --pDescriptor->mnUseCount;
- if (pDescriptor->mnUseCount <= 0)
- {
- switch (pDescriptor->meOrigin)
- {
- case DEFAULT:
- case TEMPLATE:
- default:
- break;
-
- case MASTERPAGE:
- mpImpl->ReleaseDescriptor(aToken);
- break;
- }
- }
- }
-}
-
-
-
-
-int MasterPageContainer::GetTokenCount (void) const
-{
- const ::osl::MutexGuard aGuard (mpImpl->maMutex);
-
- return mpImpl->maContainer.size();
-}
-
-
-
-
-bool MasterPageContainer::HasToken (Token aToken) const
-{
- const ::osl::MutexGuard aGuard (mpImpl->maMutex);
-
- return mpImpl->HasToken(aToken);
-}
-
-
-
-
-MasterPageContainer::Token MasterPageContainer::GetTokenForIndex (int nIndex)
-{
- const ::osl::MutexGuard aGuard (mpImpl->maMutex);
-
- Token aResult (NIL_TOKEN);
- if (HasToken(nIndex))
- aResult = mpImpl->maContainer[nIndex]->maToken;
- return aResult;
-}
-
-
-
-
-MasterPageContainer::Token MasterPageContainer::GetTokenForURL (
- const OUString& sURL)
-{
- const ::osl::MutexGuard aGuard (mpImpl->maMutex);
-
- Token aResult (NIL_TOKEN);
- if (!sURL.isEmpty())
- {
- MasterPageContainerType::iterator iEntry (
- ::std::find_if (
- mpImpl->maContainer.begin(),
- mpImpl->maContainer.end(),
- MasterPageDescriptor::URLComparator(sURL)));
- if (iEntry != mpImpl->maContainer.end())
- aResult = (*iEntry)->maToken;
- }
- return aResult;
-}
-
-
-
-
-MasterPageContainer::Token MasterPageContainer::GetTokenForStyleName (const OUString& sStyleName)
-{
- const ::osl::MutexGuard aGuard (mpImpl->maMutex);
-
- Token aResult (NIL_TOKEN);
- if (!sStyleName.isEmpty())
- {
- MasterPageContainerType::iterator iEntry (
- ::std::find_if (
- mpImpl->maContainer.begin(),
- mpImpl->maContainer.end(),
- MasterPageDescriptor::StyleNameComparator(sStyleName)));
- if (iEntry != mpImpl->maContainer.end())
- aResult = (*iEntry)->maToken;
- }
- return aResult;
-}
-
-
-
-
-MasterPageContainer::Token MasterPageContainer::GetTokenForPageObject (
- const SdPage* pPage)
-{
- const ::osl::MutexGuard aGuard (mpImpl->maMutex);
-
- Token aResult (NIL_TOKEN);
- if (pPage != NULL)
- {
- MasterPageContainerType::iterator iEntry (
- ::std::find_if (
- mpImpl->maContainer.begin(),
- mpImpl->maContainer.end(),
- MasterPageDescriptor::PageObjectComparator(pPage)));
- if (iEntry != mpImpl->maContainer.end())
- aResult = (*iEntry)->maToken;
- }
- return aResult;
-}
-
-
-
-
-OUString MasterPageContainer::GetURLForToken (
- MasterPageContainer::Token aToken)
-{
- const ::osl::MutexGuard aGuard (mpImpl->maMutex);
-
- SharedMasterPageDescriptor pDescriptor = mpImpl->GetDescriptor(aToken);
- if (pDescriptor.get() != NULL)
- return pDescriptor->msURL;
- else
- return OUString();
-}
-
-
-
-
-OUString MasterPageContainer::GetPageNameForToken (
- MasterPageContainer::Token aToken)
-{
- const ::osl::MutexGuard aGuard (mpImpl->maMutex);
-
- SharedMasterPageDescriptor pDescriptor = mpImpl->GetDescriptor(aToken);
- if (pDescriptor.get() != NULL)
- return pDescriptor->msPageName;
- else
- return OUString();
-}
-
-
-
-
-OUString MasterPageContainer::GetStyleNameForToken (
- MasterPageContainer::Token aToken)
-{
- const ::osl::MutexGuard aGuard (mpImpl->maMutex);
-
- SharedMasterPageDescriptor pDescriptor = mpImpl->GetDescriptor(aToken);
- if (pDescriptor.get() != NULL)
- return pDescriptor->msStyleName;
- else
- return OUString();
-}
-
-
-
-
-SdPage* MasterPageContainer::GetPageObjectForToken (
- MasterPageContainer::Token aToken,
- bool bLoad)
-{
- const ::osl::MutexGuard aGuard (mpImpl->maMutex);
-
- SdPage* pPageObject = NULL;
- SharedMasterPageDescriptor pDescriptor = mpImpl->GetDescriptor(aToken);
- if (pDescriptor.get() != NULL)
- {
- pPageObject = pDescriptor->mpMasterPage;
- if (pPageObject == NULL)
- {
- // The page object is not (yet) present. Call
- // UpdateDescriptor() to trigger the PageObjectProvider() to
- // provide it.
- if (bLoad)
- mpImpl->GetModel();
- if (mpImpl->UpdateDescriptor(pDescriptor,bLoad,false, true))
- pPageObject = pDescriptor->mpMasterPage;
- }
- }
- return pPageObject;
-}
-
-
-
-
-MasterPageContainer::Origin MasterPageContainer::GetOriginForToken (Token aToken)
-{
- const ::osl::MutexGuard aGuard (mpImpl->maMutex);
-
- SharedMasterPageDescriptor pDescriptor = mpImpl->GetDescriptor(aToken);
- if (pDescriptor.get() != NULL)
- return pDescriptor->meOrigin;
- else
- return UNKNOWN;
-}
-
-
-
-
-sal_Int32 MasterPageContainer::GetTemplateIndexForToken (Token aToken)
-{
- const ::osl::MutexGuard aGuard (mpImpl->maMutex);
-
- SharedMasterPageDescriptor pDescriptor = mpImpl->GetDescriptor(aToken);
- if (pDescriptor.get() != NULL)
- return pDescriptor->mnTemplateIndex;
- else
- return -1;
-}
-
-
-
-
-SharedMasterPageDescriptor MasterPageContainer::GetDescriptorForToken (
- MasterPageContainer::Token aToken)
-{
- const ::osl::MutexGuard aGuard (mpImpl->maMutex);
-
- return mpImpl->GetDescriptor(aToken);
-}
-
-
-
-void MasterPageContainer::InvalidatePreview (MasterPageContainer::Token aToken)
-{
- mpImpl->InvalidatePreview(aToken);
-}
-
-
-
-
-Image MasterPageContainer::GetPreviewForToken (MasterPageContainer::Token aToken)
-{
- return mpImpl->GetPreviewForToken(aToken,mePreviewSize);
-}
-
-
-
-
-MasterPageContainer::PreviewState MasterPageContainer::GetPreviewState (Token aToken)
-{
- return mpImpl->GetPreviewState(aToken);
-}
-
-
-
-
-bool MasterPageContainer::RequestPreview (Token aToken)
-{
- return mpImpl->RequestPreview(aToken);
-}
-
-
-
-
-//==== Implementation ================================================
-
-MasterPageContainer::Implementation::Implementation (void)
- : maMutex(),
- maContainer(),
- meInitializationState(NOT_INITIALIZED),
- mpRequestQueue(NULL),
- mxModel(NULL),
- mpDocument(NULL),
- maPreviewRenderer(),
- mbFirstPageObjectSeen(false),
- maLargePreviewBeingCreated(),
- maSmallPreviewBeingCreated(),
- maLargePreviewNotAvailable(),
- maSmallPreviewNotAvailable(),
- maChangeListeners(),
- maSmallPreviewSizePixel(),
- maLargePreviewSizePixel(),
- mbContainerCleaningPending(true)
-
-{
- UpdatePreviewSizePixel();
-}
-
-
-
-
-MasterPageContainer::Implementation::~Implementation (void)
-{
- // When the initializer or filler tasks are still running then we have
- // to stop them now in order to prevent them from calling us back.
- tools::TimerBasedTaskExecution::ReleaseTask(mpFillerTask);
-
- mpRequestQueue.reset();
-
- uno::Reference<util::XCloseable> xCloseable (mxModel, uno::UNO_QUERY);
- if (xCloseable.is())
- {
- try
- {
- xCloseable->close(true);
- }
- catch (const ::com::sun::star::util::CloseVetoException&)
- {
- }
- }
- mxModel = NULL;
-}
-
-
-
-
-void MasterPageContainer::Implementation::LateInit (void)
-{
- const ::osl::MutexGuard aGuard (maMutex);
-
- if (meInitializationState == NOT_INITIALIZED)
- {
- meInitializationState = INITIALIZING;
-
- OSL_ASSERT(Instance().get()==this);
- mpRequestQueue.reset(MasterPageContainerQueue::Create(
- ::boost::shared_ptr<MasterPageContainerQueue::ContainerAdapter>(Instance())));
-
- mpFillerTask = ::sd::tools::TimerBasedTaskExecution::Create(
- ::boost::shared_ptr<tools::AsynchronousTask>(new MasterPageContainerFiller(*this)),
- 5,
- 50);
-
- meInitializationState = INITIALIZED;
- }
-}
-
-
-
-
-void MasterPageContainer::Implementation::AddChangeListener (const Link& rLink)
-{
- const ::osl::MutexGuard aGuard (maMutex);
-
- ::std::vector<Link>::iterator iListener (
- ::std::find(maChangeListeners.begin(),maChangeListeners.end(),rLink));
- if (iListener == maChangeListeners.end())
- maChangeListeners.push_back(rLink);
-
-}
-
-
-
-
-void MasterPageContainer::Implementation::RemoveChangeListener (const Link& rLink)
-{
- const ::osl::MutexGuard aGuard (maMutex);
-
- ::std::vector<Link>::iterator iListener (
- ::std::find(maChangeListeners.begin(),maChangeListeners.end(),rLink));
- if (iListener != maChangeListeners.end())
- maChangeListeners.erase(iListener);
-}
-
-
-
-
-void MasterPageContainer::Implementation::UpdatePreviewSizePixel (void)
-{
- const ::osl::MutexGuard aGuard (maMutex);
-
- // The default aspect ratio is 4:3
- int nWidth (4);
- int nHeight (3);
-
- // Search for the first entry with an existing master page.
- MasterPageContainerType::const_iterator iDescriptor;
- MasterPageContainerType::const_iterator iContainerEnd(maContainer.end());
- for (iDescriptor=maContainer.begin(); iDescriptor!=iContainerEnd; ++iDescriptor)
- if (*iDescriptor!=0 && (*iDescriptor)->mpMasterPage != NULL)
- {
- Size aPageSize ((*iDescriptor)->mpMasterPage->GetSize());
- OSL_ASSERT(aPageSize.Width() > 0 && aPageSize.Height() > 0);
- if (aPageSize.Width() > 0)
- nWidth = aPageSize.Width();
- if (aPageSize.Height() > 0)
- nHeight = aPageSize.Height();
- mbFirstPageObjectSeen = true;
- break;
- }
-
- maSmallPreviewSizePixel.Width() = SMALL_PREVIEW_WIDTH;
- maLargePreviewSizePixel.Width() = LARGE_PREVIEW_WIDTH;
-
- int nNewSmallHeight ((maSmallPreviewSizePixel.Width()-2) * nHeight / nWidth + 2);
- int nNewLargeHeight ((maLargePreviewSizePixel.Width()-2) * nHeight / nWidth + 2);
-
- if (nNewSmallHeight!=maSmallPreviewSizePixel.Height()
- || nNewLargeHeight!=maLargePreviewSizePixel.Height())
- {
- maSmallPreviewSizePixel.Height() = nNewSmallHeight;
- maLargePreviewSizePixel.Height() = nNewLargeHeight;
- FireContainerChange(
- MasterPageContainerChangeEvent::SIZE_CHANGED,
- NIL_TOKEN);
- }
-}
-
-
-
-
-Size MasterPageContainer::Implementation::GetPreviewSizePixel (PreviewSize eSize) const
-{
- if (eSize == SMALL)
- return maSmallPreviewSizePixel;
- else
- return maLargePreviewSizePixel;
-}
-
-
-
-
-IMPL_LINK(MasterPageContainer::Implementation,AsynchronousNotifyCallback, EventData*, pData)
-{
- const ::osl::MutexGuard aGuard (maMutex);
-
- if (pData != NULL)
- {
- FireContainerChange(pData->first, pData->second, false);
- delete pData;
- }
-
- return 0;
-}
-
-
-
-
-MasterPageContainer::Token MasterPageContainer::Implementation::PutMasterPage (
- const SharedMasterPageDescriptor& rpDescriptor)
-{
- const ::osl::MutexGuard aGuard (maMutex);
-
- Token aResult (NIL_TOKEN);
-
- // Get page object and preview when that is inexpensive.
- UpdateDescriptor(rpDescriptor,false,false, false);
-
- // Look up the new MasterPageDescriptor and either insert it or update
- // an already existing one.
- MasterPageContainerType::iterator aEntry (
- ::std::find_if (
- maContainer.begin(),
- maContainer.end(),
- MasterPageDescriptor::AllComparator(rpDescriptor)));
- if (aEntry == maContainer.end())
- {
- // Insert a new MasterPageDescriptor.
- bool bIgnore (rpDescriptor->mpPageObjectProvider.get()==NULL
- && rpDescriptor->msURL.isEmpty());
-
- if ( ! bIgnore)
- {
- if (mbContainerCleaningPending)
- CleanContainer();
-
- aResult = maContainer.size();
- rpDescriptor->SetToken(aResult);
-
- // Templates are precious, i.e. we lock them so that they will
- // not be destroyed when (temporarily) no one references them.
- // They will only be deleted when the container is destroyed.
- switch (rpDescriptor->meOrigin)
- {
- case TEMPLATE:
- case DEFAULT:
- ++rpDescriptor->mnUseCount;
- break;
-
- default:
- break;
- }
-
- maContainer.push_back(rpDescriptor);
- aEntry = maContainer.end()-1;
-
- FireContainerChange(MasterPageContainerChangeEvent::CHILD_ADDED,aResult);
- }
- }
- else
- {
- // Update an existing MasterPageDescriptor.
- aResult = (*aEntry)->maToken;
- ::std::auto_ptr<std::vector<MasterPageContainerChangeEvent::EventType> > pEventTypes(
- (*aEntry)->Update(*rpDescriptor));
- if (pEventTypes.get()!=NULL && pEventTypes->size()>0)
- {
- // One or more aspects of the descriptor have changed. Send
- // appropriate events to the listeners.
- UpdateDescriptor(*aEntry,false,false, true);
-
- std::vector<MasterPageContainerChangeEvent::EventType>::const_iterator iEventType;
- for (iEventType=pEventTypes->begin(); iEventType!=pEventTypes->end(); ++iEventType)
- {
- FireContainerChange(
- *iEventType,
- (*aEntry)->maToken,
- false);
- }
- }
- }
-
- return aResult;
-}
-
-
-
-
-bool MasterPageContainer::Implementation::HasToken (Token aToken) const
-{
- return aToken>=0
- && (unsigned)aToken<maContainer.size()
- && maContainer[aToken].get()!=NULL;
-}
-
-
-
-
-const SharedMasterPageDescriptor MasterPageContainer::Implementation::GetDescriptor (
- Token aToken) const
-{
- if (aToken>=0 && (unsigned)aToken<maContainer.size())
- return maContainer[aToken];
- else
- return SharedMasterPageDescriptor();
-}
-
-
-
-
-SharedMasterPageDescriptor MasterPageContainer::Implementation::GetDescriptor (Token aToken)
-{
- if (aToken>=0 && (unsigned)aToken<maContainer.size())
- return maContainer[aToken];
- else
- return SharedMasterPageDescriptor();
-}
-
-
-
-
-void MasterPageContainer::Implementation::InvalidatePreview (Token aToken)
-{
- const ::osl::MutexGuard aGuard (maMutex);
-
- SharedMasterPageDescriptor pDescriptor (GetDescriptor(aToken));
- if (pDescriptor.get() != NULL)
- {
- pDescriptor->maSmallPreview = Image();
- pDescriptor->maLargePreview = Image();
- RequestPreview(aToken);
- }
-}
-
-
-
-
-Image MasterPageContainer::Implementation::GetPreviewForToken (
- MasterPageContainer::Token aToken,
- PreviewSize ePreviewSize)
-{
- const ::osl::MutexGuard aGuard (maMutex);
-
- Image aPreview;
- PreviewState ePreviewState (GetPreviewState(aToken));
-
- SharedMasterPageDescriptor pDescriptor = GetDescriptor(aToken);
-
- // When the preview is missing but inexpensively creatable then do that
- // now.
- if (pDescriptor.get()!=NULL)
- {
- if (ePreviewState == PS_CREATABLE)
- if (UpdateDescriptor(pDescriptor, false,false, true))
- if (pDescriptor->maLargePreview.GetSizePixel().Width() != 0)
- ePreviewState = PS_AVAILABLE;
-
- switch (ePreviewState)
- {
- case PS_AVAILABLE:
- aPreview = pDescriptor->GetPreview(ePreviewSize);
- break;
-
- case PS_PREPARING:
- aPreview = GetPreviewSubstitution(
- STR_TASKPANEL_PREPARING_PREVIEW_SUBSTITUTION,
- ePreviewSize);
- break;
-
- case PS_CREATABLE:
- aPreview = GetPreviewSubstitution(
- STR_TASKPANEL_PREPARING_PREVIEW_SUBSTITUTION,
- ePreviewSize);
- break;
-
- case PS_NOT_AVAILABLE:
- aPreview = GetPreviewSubstitution(
- STR_TASKPANEL_NOT_AVAILABLE_SUBSTITUTION,
- ePreviewSize);
- if (ePreviewSize == SMALL)
- pDescriptor->maSmallPreview = aPreview;
- else
- pDescriptor->maLargePreview = aPreview;
- break;
- }
- }
-
- return aPreview;
-}
-
-
-
-
-MasterPageContainer::PreviewState MasterPageContainer::Implementation::GetPreviewState (
- Token aToken) const
-{
- const ::osl::MutexGuard aGuard (maMutex);
-
- PreviewState eState (PS_NOT_AVAILABLE);
-
- SharedMasterPageDescriptor pDescriptor = GetDescriptor(aToken);
- if (pDescriptor.get() != NULL)
- {
- if (pDescriptor->maLargePreview.GetSizePixel().Width() != 0)
- eState = PS_AVAILABLE;
- else if (pDescriptor->mpPreviewProvider.get() != NULL)
- {
- // The preview does not exist but can be created. When that is
- // not expensive then do it at once.
- if (mpRequestQueue->HasRequest(aToken))
- eState = PS_PREPARING;
- else
- eState = PS_CREATABLE;
- }
- else
- eState = PS_NOT_AVAILABLE;
- }
-
- return eState;
-}
-
-
-
-
-bool MasterPageContainer::Implementation::RequestPreview (Token aToken)
-{
- SharedMasterPageDescriptor pDescriptor = GetDescriptor(aToken);
- if (pDescriptor.get() != NULL)
- return mpRequestQueue->RequestPreview(pDescriptor);
- else
- return false;
-}
-
-
-
-
-Reference<frame::XModel> MasterPageContainer::Implementation::GetModel (void)
-{
- const ::osl::MutexGuard aGuard (maMutex);
-
- if ( ! mxModel.is())
- {
- // Get the desktop a s service factory.
- uno::Reference<frame::XDesktop2> xDesktop = frame::Desktop::create(
- ::comphelper::getProcessComponentContext() );
-
- // Create a new model.
- OUString sModelServiceName ( "com.sun.star.presentation.PresentationDocument");
- mxModel = uno::Reference<frame::XModel>(
- ::comphelper::getProcessServiceFactory()->createInstance(
- sModelServiceName),
- uno::UNO_QUERY);
-
- // Initialize the model.
- uno::Reference<frame::XLoadable> xLoadable (mxModel,uno::UNO_QUERY);
- if (xLoadable.is())
- xLoadable->initNew();
-
- // Use its tunnel to get a pointer to its core implementation.
- uno::Reference<lang::XUnoTunnel> xUnoTunnel (mxModel, uno::UNO_QUERY);
- if (xUnoTunnel.is())
- {
- mpDocument = reinterpret_cast<SdXImpressDocument*>(
- xUnoTunnel->getSomething(
- SdXImpressDocument::getUnoTunnelId()))->GetDoc();
- }
-
- // Create a default page.
- uno::Reference<drawing::XDrawPagesSupplier> xSlideSupplier (mxModel, uno::UNO_QUERY);
- if (xSlideSupplier.is())
- {
- uno::Reference<drawing::XDrawPages> xSlides (
- xSlideSupplier->getDrawPages(), uno::UNO_QUERY);
- if (xSlides.is())
- {
- sal_Int32 nIndex (0);
- uno::Reference<drawing::XDrawPage> xNewPage (xSlides->insertNewByIndex(nIndex));
- uno::Reference<beans::XPropertySet> xProperties(xNewPage, uno::UNO_QUERY);
- if (xProperties.is())
- xProperties->setPropertyValue(
- "Layout",
- makeAny((sal_Int16)AUTOLAYOUT_TITLE));
- }
- }
- }
- return mxModel;
-}
-
-
-
-
-SdDrawDocument* MasterPageContainer::Implementation::GetDocument (void)
-{
- GetModel();
- return mpDocument;
-}
-
-
-
-
-Image MasterPageContainer::Implementation::GetPreviewSubstitution (
- sal_uInt16 nId,
- PreviewSize ePreviewSize)
-{
- const ::osl::MutexGuard aGuard (maMutex);
-
- Image aPreview;
-
- switch (nId)
- {
- case STR_TASKPANEL_PREPARING_PREVIEW_SUBSTITUTION:
- {
- Image& rPreview (ePreviewSize==SMALL
- ? maSmallPreviewBeingCreated
- : maLargePreviewBeingCreated);
- if (rPreview.GetSizePixel().Width() == 0)
- {
- rPreview = maPreviewRenderer.RenderSubstitution(
- ePreviewSize==SMALL ? maSmallPreviewSizePixel : maLargePreviewSizePixel,
- SdResId(STR_TASKPANEL_PREPARING_PREVIEW_SUBSTITUTION));
- }
- aPreview = rPreview;
- }
- break;
-
- case STR_TASKPANEL_NOT_AVAILABLE_SUBSTITUTION:
- {
- Image& rPreview (ePreviewSize==SMALL
- ? maSmallPreviewNotAvailable
- : maLargePreviewNotAvailable);
- if (rPreview.GetSizePixel().Width() == 0)
- {
- rPreview = maPreviewRenderer.RenderSubstitution(
- ePreviewSize==SMALL ? maSmallPreviewSizePixel : maLargePreviewSizePixel,
- SdResId(STR_TASKPANEL_NOT_AVAILABLE_SUBSTITUTION));
- }
- aPreview = rPreview;
- }
- break;
- }
-
- return aPreview;
-}
-
-
-
-
-void MasterPageContainer::Implementation::CleanContainer (void)
-{
- // Remove the empty elements at the end of the container. The empty
- // elements in the middle can not be removed because that would
- // invalidate the references still held by others.
- int nIndex (maContainer.size()-1);
- while (nIndex>=0 && maContainer[nIndex].get()==NULL)
- --nIndex;
- maContainer.resize(++nIndex);
-}
-
-
-
-
-void MasterPageContainer::Implementation::FireContainerChange (
- MasterPageContainerChangeEvent::EventType eType,
- Token aToken,
- bool bNotifyAsynchronously)
-{
- if (bNotifyAsynchronously)
- {
- Application::PostUserEvent(
- LINK(this,Implementation,AsynchronousNotifyCallback),
- new EventData(eType,aToken));
- }
- else
- {
- ::std::vector<Link> aCopy(maChangeListeners.begin(),maChangeListeners.end());
- ::std::vector<Link>::iterator iListener;
- MasterPageContainerChangeEvent aEvent;
- aEvent.meEventType = eType;
- aEvent.maChildToken = aToken;
- for (iListener=aCopy.begin(); iListener!=aCopy.end(); ++iListener)
- iListener->Call(&aEvent);
- }
-}
-
-
-
-
-bool MasterPageContainer::Implementation::UpdateDescriptor (
- const SharedMasterPageDescriptor& rpDescriptor,
- bool bForcePageObject,
- bool bForcePreview,
- bool bSendEvents)
-{
- const ::osl::MutexGuard aGuard (maMutex);
-
- // We have to create the page object when the preview provider needs it
- // and the caller needs the preview.
- bForcePageObject |= (bForcePreview
- && rpDescriptor->mpPreviewProvider->NeedsPageObject()
- && rpDescriptor->mpMasterPage==NULL);
-
- // Define a cost threshold so that an update or page object or preview
- // that is at least this cost are made at once. Updates with higher cost
- // are scheduled for later.
- sal_Int32 nCostThreshold (mpRequestQueue->IsEmpty() ? 5 : 0);
-
- // Update the page object (which may be used for the preview update).
- if (bForcePageObject)
- GetDocument();
- int nPageObjectModified (rpDescriptor->UpdatePageObject(
- (bForcePageObject ? -1 : nCostThreshold),
- mpDocument));
- if (nPageObjectModified == 1 && bSendEvents)
- FireContainerChange(
- MasterPageContainerChangeEvent::DATA_CHANGED,
- rpDescriptor->maToken);
- if (nPageObjectModified == -1 && bSendEvents)
- FireContainerChange(
- MasterPageContainerChangeEvent::CHILD_REMOVED,
- rpDescriptor->maToken);
- if (nPageObjectModified && ! mbFirstPageObjectSeen)
- UpdatePreviewSizePixel();
-
- // Update the preview.
- bool bPreviewModified (rpDescriptor->UpdatePreview(
- (bForcePreview ? -1 : nCostThreshold),
- maSmallPreviewSizePixel,
- maLargePreviewSizePixel,
- maPreviewRenderer));
-
- if (bPreviewModified && bSendEvents)
- FireContainerChange(
- MasterPageContainerChangeEvent::PREVIEW_CHANGED,
- rpDescriptor->maToken);
-
- return nPageObjectModified || bPreviewModified;
-}
-
-
-
-
-void MasterPageContainer::Implementation::ReleaseDescriptor (Token aToken)
-{
- if (aToken>=0 && (unsigned)aToken<maContainer.size())
- {
- maContainer[aToken].reset();
- mbContainerCleaningPending = true;
- }
-}
-
-
-
-
-void MasterPageContainer::Implementation::FillingDone (void)
-{
- mpRequestQueue->ProcessAllRequests();
-}
-
-
-
-} } } // end of namespace ::sd::toolpanel::controls
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/toolpanel/controls/MasterPageContainer.hxx b/sd/source/ui/toolpanel/controls/MasterPageContainer.hxx
deleted file mode 100644
index b0bfd75bfd25..000000000000
--- a/sd/source/ui/toolpanel/controls/MasterPageContainer.hxx
+++ /dev/null
@@ -1,208 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#ifndef SD_TOOLPANEL_CONTROLS_MASTER_PAGE_CONTAINER_HXX
-#define SD_TOOLPANEL_CONTROLS_MASTER_PAGE_CONTAINER_HXX
-
-#include "MasterPageContainerProviders.hxx"
-
-#include <osl/mutex.hxx>
-#include <tools/string.hxx>
-#include <vcl/image.hxx>
-#include <memory>
-#include "PreviewRenderer.hxx"
-#include <com/sun/star/frame/XModel.hpp>
-#include <vcl/timer.hxx>
-#include "tools/SdGlobalResourceContainer.hxx"
-
-#include <boost/shared_ptr.hpp>
-
-class SdPage;
-
-namespace sd { namespace toolpanel { namespace controls {
-
-class MasterPageDescriptor;
-
-/** This container manages the master pages used by the MasterPagesSelector
- controls. It uses internally a singleton implementation object.
- Therefore, all MasterPageContainer object operator on the same set of
- master pages. Each MasterPageContainer, however, has its own
- PreviewSize value and thus can independantly switch between large and
- small previews.
-
- The container maintains its own document to store master page objects.
-
- For each master page container stores its URL, preview bitmap, page
- name, and, if available, the page object.
-
- Entries are accessed via a Token, which is mostly a numerical index but
- whose values do not necessarily have to be consecutive.
-*/
-class MasterPageContainer
-{
-public:
- typedef int Token;
- static const Token NIL_TOKEN = -1;
-
- MasterPageContainer (void);
- virtual ~MasterPageContainer (void);
-
- void AddChangeListener (const Link& rLink);
- void RemoveChangeListener (const Link& rLink);
-
- enum PreviewSize { SMALL, LARGE };
- /** There are two different preview sizes, a small one and a large one.
- Which one is used by the called container can be changed with this
- method.
- When the preview size is changed then all change listeners are
- notified of this.
- */
- void SetPreviewSize (PreviewSize eSize);
-
- /** Returns the preview size.
- */
- PreviewSize GetPreviewSize (void) const;
-
- /** Return the preview size in pixels.
- */
- Size GetPreviewSizePixel (void) const;
-
- enum PreviewState { PS_AVAILABLE, PS_CREATABLE, PS_PREPARING, PS_NOT_AVAILABLE };
- PreviewState GetPreviewState (Token aToken);
-
- /** This method is typically called for entries in the container for
- which GetPreviewState() returns OS_CREATABLE. The creation of the
- preview is then scheduled to be executed asynchronously at a later
- point in time. When the preview is available the change listeners
- will be notified.
- */
- bool RequestPreview (Token aToken);
-
- /** Each entry of the container is either the first page of a template
- document or is a master page of an Impress document.
- */
- enum Origin {
- MASTERPAGE, // Master page of a document.
- TEMPLATE, // First page of a template file.
- DEFAULT, // Empty master page with default style.
- UNKNOWN
- };
-
- /** Put the master page identified and described by the given parameters
- into the container. When there already is a master page with the
- given URL, page name, or object pointer (when that is not NULL) then
- the existing entry is replaced/updated by the given one. Otherwise
- a new entry is inserted.
- */
- Token PutMasterPage (const ::boost::shared_ptr<MasterPageDescriptor>& rDescriptor);
- void AcquireToken (Token aToken);
- void ReleaseToken (Token aToken);
-
- /** This and the GetTokenForIndex() methods can be used to iterate over
- all members of the container.
- */
- int GetTokenCount (void) const;
-
- /** Determine whether the container has a member for the given token.
- */
- bool HasToken (Token aToken) const;
-
- /** Return a token for an index in the range
- 0 <= index < GetTokenCount().
- */
- Token GetTokenForIndex (int nIndex);
-
- Token GetTokenForURL (const OUString& sURL);
- Token GetTokenForStyleName (const OUString& sStyleName);
- Token GetTokenForPageObject (const SdPage* pPage);
-
- OUString GetURLForToken (Token aToken);
- OUString GetPageNameForToken (Token aToken);
- OUString GetStyleNameForToken (Token aToken);
- SdPage* GetPageObjectForToken (Token aToken, bool bLoad=true);
- Origin GetOriginForToken (Token aToken);
- sal_Int32 GetTemplateIndexForToken (Token aToken);
- ::boost::shared_ptr<MasterPageDescriptor> GetDescriptorForToken (Token aToken);
-
- void InvalidatePreview (Token aToken);
-
- /** Return a preview for the specified token. When the preview is not
- present then the PreviewProvider associated with the token is
- executed only when that is not expensive. It is the responsibility
- of the caller to call RequestPreview() to do the same
- (asynchronously) for expensive PreviewProviders.
- Call GetPreviewState() to find out if that is necessary.
- @param aToken
- This token specifies for which master page to return the prview.
- Tokens are returned for example by the GetTokenFor...() methods.
- @return
- The returned image is the requested preview or a substitution.
- */
- Image GetPreviewForToken (Token aToken);
-
-private:
- class Implementation;
- ::boost::shared_ptr<Implementation> mpImpl;
- PreviewSize mePreviewSize;
-
- /** Retrieve the preview of the document specified by the given URL.
- */
- static BitmapEx LoadPreviewFromURL (const OUString& aURL);
-};
-
-
-
-
-/** For some changes to the set of master pages in a MasterPageContainer or
- to the data stored for each master page one or more events are sent to
- registered listeners.
- Each event has an event type and a token that tells the listener where
- the change took place.
-*/
-class MasterPageContainerChangeEvent
-{
-public:
- enum EventType {
- // A master page was added to the container.
- CHILD_ADDED,
- // A master page was removed from the container.
- CHILD_REMOVED,
- // The preview of a master page has changed.
- PREVIEW_CHANGED,
- // The size of a preview has changed.
- SIZE_CHANGED,
- // Some of the data stored for a master page has changed.
- DATA_CHANGED,
- // The TemplateIndex of a master page has changed.
- INDEX_CHANGED,
- // More than one entries changed their TemplateIndex
- INDEXES_CHANGED
- } meEventType;
-
- // Token of the container entry whose data changed or which was added or
- // removed.
- MasterPageContainer::Token maChildToken;
-};
-
-
-} } } // end of namespace ::sd::toolpanel::controls
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/toolpanel/controls/MasterPageContainerFiller.cxx b/sd/source/ui/toolpanel/controls/MasterPageContainerFiller.cxx
deleted file mode 100644
index 666666bbedec..000000000000
--- a/sd/source/ui/toolpanel/controls/MasterPageContainerFiller.cxx
+++ /dev/null
@@ -1,191 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-
-#include "MasterPageContainerFiller.hxx"
-
-#include "MasterPageDescriptor.hxx"
-#include "MasterPageContainerProviders.hxx"
-#include "TemplateScanner.hxx"
-
-using namespace ::com::sun::star;
-using namespace ::com::sun::star::uno;
-using namespace ::sd::toolpanel::controls;
-
-
-namespace sd { namespace toolpanel { namespace controls {
-
-MasterPageContainerFiller::MasterPageContainerFiller (ContainerAdapter& rpAdapter)
- : mrContainerAdapter(rpAdapter),
- meState(INITIALIZE_TEMPLATE_SCANNER),
- mpScannerTask(),
- mpLastAddedEntry(NULL),
- mnIndex(1)
-{
- // Add one entry for the default master page. We use temporarily the
- // DefaultPagePreviewProvider to prevent the rendering (and the
- // expensive creation) of the default page. It is replaced later on by
- // another.
- SharedMasterPageDescriptor pDescriptor (new MasterPageDescriptor(
- MasterPageContainer::DEFAULT,
- 0,
- OUString(),
- OUString(),
- OUString(),
- false,
- ::boost::shared_ptr<PageObjectProvider>(new DefaultPageObjectProvider()),
- ::boost::shared_ptr<PreviewProvider>(new PagePreviewProvider())));
- mrContainerAdapter.PutMasterPage(pDescriptor);
-}
-
-
-
-
-MasterPageContainerFiller::~MasterPageContainerFiller (void)
-{
-}
-
-
-
-
-void MasterPageContainerFiller::RunNextStep (void)
-{
- switch (meState)
- {
- case INITIALIZE_TEMPLATE_SCANNER:
- mpScannerTask.reset(new TemplateScanner());
- meState = SCAN_TEMPLATE;
- break;
-
- case SCAN_TEMPLATE:
- meState = ScanTemplate();
- break;
-
- case ADD_TEMPLATE:
- meState = AddTemplate();
- break;
-
- case DONE:
- case ERROR:
- default:
- break;
- }
-
- // When the state has just been set to DONE or ERROR then tell the
- // container that no more templates will be coming and stop the
- // scanning.
- switch (meState)
- {
- case DONE:
- case ERROR:
- if (mpScannerTask.get() != NULL)
- {
- mrContainerAdapter.FillingDone();
- mpScannerTask.reset();
- }
- default:
- break;
- }
-}
-
-
-
-
-bool MasterPageContainerFiller::HasNextStep (void)
-{
- switch (meState)
- {
- case DONE:
- case ERROR:
- return false;
-
- default:
- return true;
- }
-}
-
-
-
-
-MasterPageContainerFiller::State MasterPageContainerFiller::ScanTemplate (void)
-{
- State eState (ERROR);
-
- if (mpScannerTask.get() != NULL)
- {
- if (mpScannerTask->HasNextStep())
- {
- mpScannerTask->RunNextStep();
- if (mpScannerTask->GetLastAddedEntry() != mpLastAddedEntry)
- {
- mpLastAddedEntry = mpScannerTask->GetLastAddedEntry();
- if (mpLastAddedEntry != NULL)
- eState = ADD_TEMPLATE;
- else
- eState = SCAN_TEMPLATE;
- }
- else
- eState = SCAN_TEMPLATE;
- }
- else
- eState = DONE;
- }
-
- return eState;
-}
-
-
-
-
-MasterPageContainerFiller::State MasterPageContainerFiller::AddTemplate (void)
-{
- if (mpLastAddedEntry != NULL)
- {
- SharedMasterPageDescriptor pDescriptor (new MasterPageDescriptor(
- MasterPageContainer::TEMPLATE,
- mnIndex,
- mpLastAddedEntry->msPath,
- mpLastAddedEntry->msTitle,
- OUString(),
- false,
- ::boost::shared_ptr<PageObjectProvider>(
- new TemplatePageObjectProvider(mpLastAddedEntry->msPath)),
- ::boost::shared_ptr<PreviewProvider>(
- new TemplatePreviewProvider(mpLastAddedEntry->msPath))));
- // For user supplied templates we use a different preview provider:
- // The preview in the document shows not only shapes on the master
- // page but also shapes on the foreground. This is misleading and
- // therefore these previews are discarded and created directly from
- // the page objects.
- if (pDescriptor->GetURLClassification() == MasterPageDescriptor::URLCLASS_USER)
- pDescriptor->mpPreviewProvider = ::boost::shared_ptr<PreviewProvider>(
- new PagePreviewProvider());
-
- mrContainerAdapter.PutMasterPage(pDescriptor);
- ++mnIndex;
- }
-
- return SCAN_TEMPLATE;
-}
-
-
-
-} } } // end of namespace ::sd::toolpanel::controls
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/toolpanel/controls/MasterPageContainerFiller.hxx b/sd/source/ui/toolpanel/controls/MasterPageContainerFiller.hxx
deleted file mode 100644
index db92759ca912..000000000000
--- a/sd/source/ui/toolpanel/controls/MasterPageContainerFiller.hxx
+++ /dev/null
@@ -1,92 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#ifndef SD_TOOLPANEL_CONTROLS_MASTER_PAGE_CONTAINER_FILLER_HXX
-#define SD_TOOLPANEL_CONTROLS_MASTER_PAGE_CONTAINER_FILLER_HXX
-
-#include "MasterPageContainer.hxx"
-#include "MasterPageDescriptor.hxx"
-#include "tools/AsynchronousTask.hxx"
-
-namespace sd {
-class TemplateScanner;
-class TemplateEntry;
-}
-
-namespace sd { namespace toolpanel { namespace controls {
-
-/** Fill a MasterPageContainer with information about the available master
- pages. These are provided by one default page and from the existing
- Impress templates. This is done asynchronously.
-*/
-class MasterPageContainerFiller
- : public ::sd::tools::AsynchronousTask
-{
-public:
- class ContainerAdapter
- {
- public:
- virtual MasterPageContainer::Token PutMasterPage (
- const SharedMasterPageDescriptor& rpDescriptor) = 0;
- /** This method is called when all Impress templates have been added
- to the container via the PutMasterPage() method.
- */
- virtual void FillingDone (void) = 0;
-
- protected:
- ~ContainerAdapter() {}
- };
-
- MasterPageContainerFiller (ContainerAdapter& rContainerAdapter);
- virtual ~MasterPageContainerFiller (void);
-
- /** Run the next step of the task. After HasNextStep() returns false
- this method should ignore further calls.
- */
- virtual void RunNextStep (void);
-
- /** Return <TRUE/> when there is at least one more step to execute.
- When the task has been executed completely then <FALSE/> is
- returned.
- */
- virtual bool HasNextStep (void);
-
-private:
- ContainerAdapter& mrContainerAdapter;
- // Remember what the next step has to do.
- enum State {
- INITIALIZE_TEMPLATE_SCANNER,
- SCAN_TEMPLATE,
- ADD_TEMPLATE,
- ERROR,
- DONE
- } meState;
- ::std::auto_ptr<TemplateScanner> mpScannerTask;
- const TemplateEntry* mpLastAddedEntry;
- int mnIndex;
-
- State ScanTemplate (void);
- State AddTemplate (void);
-};
-
-} } } // end of namespace ::sd::toolpanel::controls
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/toolpanel/controls/MasterPageContainerProviders.cxx b/sd/source/ui/toolpanel/controls/MasterPageContainerProviders.cxx
deleted file mode 100644
index 6eb29ed27714..000000000000
--- a/sd/source/ui/toolpanel/controls/MasterPageContainerProviders.cxx
+++ /dev/null
@@ -1,312 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-
-#include "MasterPageContainerProviders.hxx"
-
-#include "DrawDocShell.hxx"
-#include "drawdoc.hxx"
-#include "PreviewRenderer.hxx"
-#include <comphelper/processfactory.hxx>
-#include <sfx2/app.hxx>
-#include <sfx2/sfxsids.hrc>
-#include <sfx2/thumbnailview.hxx>
-#include <unotools/ucbstreamhelper.hxx>
-#include <vcl/image.hxx>
-#include <vcl/pngread.hxx>
-#include <com/sun/star/embed/ElementModes.hpp>
-#include <com/sun/star/embed/StorageFactory.hpp>
-#include <tools/diagnose_ex.h>
-
-using namespace ::com::sun::star;
-using namespace ::com::sun::star::uno;
-using namespace ::sd::toolpanel::controls;
-
-
-namespace sd { namespace toolpanel { namespace controls {
-
-
-//===== PagePreviewProvider ===================================================
-
-PagePreviewProvider::PagePreviewProvider (void)
-{
-}
-
-
-
-
-Image PagePreviewProvider::operator () (
- int nWidth,
- SdPage* pPage,
- ::sd::PreviewRenderer& rRenderer)
-{
- Image aPreview;
-
- if (pPage != NULL)
- {
- // Use the given renderer to create a preview of the given page
- // object.
- aPreview = rRenderer.RenderPage(
- pPage,
- nWidth,
- OUString(),
- false);
- }
-
- return aPreview;
-}
-
-
-
-
-int PagePreviewProvider::GetCostIndex (void)
-{
- return 5;
-}
-
-
-
-
-bool PagePreviewProvider::NeedsPageObject (void)
-{
- return true;
-}
-
-
-
-
-//===== TemplatePreviewProvider ===============================================
-
-TemplatePreviewProvider::TemplatePreviewProvider (const OUString& rsURL)
- : msURL(rsURL)
-{
-}
-
-
-
-
-Image TemplatePreviewProvider::operator() (
- int nWidth,
- SdPage* pPage,
- ::sd::PreviewRenderer& rRenderer)
-{
- // Unused parameters.
- (void)nWidth;
- (void)pPage;
- (void)rRenderer;
-
- return ThumbnailView::readThumbnail(msURL);
-}
-
-
-
-
-int TemplatePreviewProvider::GetCostIndex (void)
-{
- return 10;
-}
-
-
-
-
-bool TemplatePreviewProvider::NeedsPageObject (void)
-{
- return false;
-}
-
-
-
-
-//===== TemplatePageObjectProvider =============================================
-
-TemplatePageObjectProvider::TemplatePageObjectProvider (const OUString& rsURL)
- : msURL(rsURL),
- mxDocumentShell()
-{
-}
-
-
-
-
-SdPage* TemplatePageObjectProvider::operator() (SdDrawDocument* pContainerDocument)
-{
- // Unused parameters.
- (void)pContainerDocument;
-
- SdPage* pPage = NULL;
-
- mxDocumentShell = NULL;
- ::sd::DrawDocShell* pDocumentShell = NULL;
- try
- {
- // Load the template document and return its first page.
- pDocumentShell = LoadDocument (msURL);
- if (pDocumentShell != NULL)
- {
- SdDrawDocument* pDocument = pDocumentShell->GetDoc();
- if (pDocument != NULL)
- {
- pPage = pDocument->GetMasterSdPage(0, PK_STANDARD);
- // In order to make the newly loaded master page deletable
- // when copied into documents it is marked as no "precious".
- // When it is modified then it is marked as "precious".
- if (pPage != NULL)
- pPage->SetPrecious(false);
- }
- }
- }
- catch (const uno::RuntimeException&)
- {
- DBG_UNHANDLED_EXCEPTION();
- pPage = NULL;
- }
-
- return pPage;
-}
-
-
-
-
-::sd::DrawDocShell* TemplatePageObjectProvider::LoadDocument (const OUString& sFileName)
-{
- SfxApplication* pSfxApp = SFX_APP();
- SfxItemSet* pSet = new SfxAllItemSet (pSfxApp->GetPool());
- pSet->Put (SfxBoolItem (SID_TEMPLATE, sal_True));
- pSet->Put (SfxBoolItem (SID_PREVIEW, sal_True));
- if (pSfxApp->LoadTemplate (mxDocumentShell, sFileName, sal_True, pSet))
- {
- mxDocumentShell = NULL;
- }
- SfxObjectShell* pShell = mxDocumentShell;
- return PTR_CAST(::sd::DrawDocShell,pShell);
-}
-
-
-
-
-int TemplatePageObjectProvider::GetCostIndex (void)
-{
- return 20;
-}
-
-
-
-
-bool TemplatePageObjectProvider::operator== (const PageObjectProvider& rProvider)
-{
- const TemplatePageObjectProvider* pTemplatePageObjectProvider
- = dynamic_cast<const TemplatePageObjectProvider*>(&rProvider);
- if (pTemplatePageObjectProvider != NULL)
- return (msURL == pTemplatePageObjectProvider->msURL);
- else
- return false;
-}
-
-
-
-
-//===== DefaultPageObjectProvider ==============================================
-
-DefaultPageObjectProvider::DefaultPageObjectProvider (void)
-{
-}
-
-
-
-
-SdPage* DefaultPageObjectProvider::operator () (SdDrawDocument* pContainerDocument)
-{
- SdPage* pLocalMasterPage = NULL;
- if (pContainerDocument != NULL)
- {
- sal_Int32 nIndex (0);
- SdPage* pLocalSlide = pContainerDocument->GetSdPage((sal_uInt16)nIndex, PK_STANDARD);
- if (pLocalSlide!=NULL && pLocalSlide->TRG_HasMasterPage())
- pLocalMasterPage = dynamic_cast<SdPage*>(&pLocalSlide->TRG_GetMasterPage());
- }
-
- if (pLocalMasterPage == NULL)
- {
- DBG_ASSERT(false, "can not create master page for slide");
- }
-
- return pLocalMasterPage;
-}
-
-
-
-
-int DefaultPageObjectProvider::GetCostIndex (void)
-{
- return 15;
-}
-
-
-
-
-bool DefaultPageObjectProvider::operator== (const PageObjectProvider& rProvider)
-{
- return (dynamic_cast<const DefaultPageObjectProvider*>(&rProvider) != NULL);
-}
-
-
-
-
-//===== ExistingPageProvider ==================================================
-
-ExistingPageProvider::ExistingPageProvider (SdPage* pPage)
- : mpPage(pPage)
-{
-}
-
-
-
-
-SdPage* ExistingPageProvider::operator() (SdDrawDocument* pDocument)
-{
- (void)pDocument; // Unused parameter.
-
- return mpPage;
-}
-
-
-
-
-int ExistingPageProvider::GetCostIndex (void)
-{
- return 0;
-}
-
-
-
-
-bool ExistingPageProvider::operator== (const PageObjectProvider& rProvider)
-{
- const ExistingPageProvider* pExistingPageProvider
- = dynamic_cast<const ExistingPageProvider*>(&rProvider);
- if (pExistingPageProvider != NULL)
- return (mpPage == pExistingPageProvider->mpPage);
- else
- return false;
-}
-
-
-} } } // end of namespace ::sd::toolpanel::controls
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/toolpanel/controls/MasterPageContainerProviders.hxx b/sd/source/ui/toolpanel/controls/MasterPageContainerProviders.hxx
deleted file mode 100644
index dfe4785357f7..000000000000
--- a/sd/source/ui/toolpanel/controls/MasterPageContainerProviders.hxx
+++ /dev/null
@@ -1,192 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#ifndef SD_TOOLPANEL_CONTROLS_MASTER_PAGE_CONTAINER_PROVIDERS_HXX
-#define SD_TOOLPANEL_CONTROLS_MASTER_PAGE_CONTAINER_PROVIDERS_HXX
-
-#include <rtl/ustring.hxx>
-#include <sfx2/objsh.hxx>
-
-class Image;
-class SdDrawDocument;
-class SdPage;
-namespace sd { class PreviewRenderer; }
-namespace sd { class DrawDocShell; }
-
-
-namespace sd { namespace toolpanel { namespace controls {
-
-
-/** Interface for a provider of page objects. It is used by the
- MasterPageDescriptor to create master page objects on demand.
-*/
-class PageObjectProvider
-{
-public:
- /** Return a master page either by returning an already existing one, by
- creating a new page, or by loading a document.
- @param pDocument
- The document of the MasterPageContainer. It may be used to
- create new pages.
- */
- virtual SdPage* operator() (SdDrawDocument* pDocument) = 0;
-
- /** An abstract value for the expected cost of providing a master page
- object.
- @return
- A value of 0 represents for the lowest cost, i.e. an almost
- immediate return. Positive values stand for higher costs.
- Negative values are not supported.
- */
- virtual int GetCostIndex (void) = 0;
-
- virtual bool operator== (const PageObjectProvider& rProvider) = 0;
-
-protected:
- ~PageObjectProvider() {}
-};
-
-
-
-
-class PreviewProvider
-{
-public:
- /** Create a preview image in the specified width.
- @param nWidth
- Requested width of the preview. The calling method can cope
- with other sizes as well but the resulting image quality is
- better when the returned image has the requested size.
- @param pPage
- Page object for which a preview is requested. This may be NULL
- when the page object is expensive to get and the PreviewProvider
- does not need this object (NeedsPageObject() returns false.)
- @param rRenderer
- This PreviewRenderer may be used by the PreviewProvider to
- create a preview image.
- */
- virtual Image operator() (int nWidth, SdPage* pPage, ::sd::PreviewRenderer& rRenderer) = 0;
-
- /** Return a value that indicates how expensive the creation of a
- preview image is. The higher the returned value the more expensive
- is the preview creation. Return 0 when the preview is already
- present and can be returned immediately.
- */
- virtual int GetCostIndex (void) = 0;
-
- /** Return whether the page object passed is necessary to create a
- preview.
- */
- virtual bool NeedsPageObject (void) = 0;
-
-protected:
- ~PreviewProvider() {}
-};
-
-
-
-
-/** Provide previews of existing page objects by rendering them.
-*/
-class PagePreviewProvider : public PreviewProvider
-{
-public:
- PagePreviewProvider (void);
- virtual ~PagePreviewProvider() {}
- virtual Image operator () (int nWidth, SdPage* pPage, ::sd::PreviewRenderer& rRenderer);
- virtual int GetCostIndex (void);
- virtual bool NeedsPageObject (void);
-private:
-};
-
-
-
-
-/** Provide master page objects for template documents for which only the
- URL is given.
-*/
-class TemplatePageObjectProvider : public PageObjectProvider
-{
-public:
- TemplatePageObjectProvider (const OUString& rsURL);
- virtual ~TemplatePageObjectProvider (void) {};
- virtual SdPage* operator () (SdDrawDocument* pDocument);
- virtual int GetCostIndex (void);
- virtual bool operator== (const PageObjectProvider& rProvider);
-private:
- OUString msURL;
- SfxObjectShellLock mxDocumentShell;
- ::sd::DrawDocShell* LoadDocument (const OUString& sFileName);
-};
-
-
-
-
-/** Provide previews for template documents by loading the thumbnails from
- the documents.
-*/
-class TemplatePreviewProvider : public PreviewProvider
-{
-public:
- TemplatePreviewProvider (const OUString& rsURL);
- virtual ~TemplatePreviewProvider (void) {};
- virtual Image operator() (int nWidth, SdPage* pPage, ::sd::PreviewRenderer& rRenderer);
- virtual int GetCostIndex (void);
- virtual bool NeedsPageObject (void);
-private:
- OUString msURL;
-};
-
-
-
-
-/** Create an empty default master page.
-*/
-class DefaultPageObjectProvider : public PageObjectProvider
-{
-public:
- DefaultPageObjectProvider (void);
- virtual ~DefaultPageObjectProvider() {}
- virtual SdPage* operator () (SdDrawDocument* pDocument);
- virtual int GetCostIndex (void);
- virtual bool operator== (const PageObjectProvider& rProvider);
-};
-
-
-
-/** This implementation of the PageObjectProvider simply returns an already
- existing master page object.
-*/
-class ExistingPageProvider : public ::sd::toolpanel::controls::PageObjectProvider
-{
-public:
- ExistingPageProvider (SdPage* pPage);
- virtual ~ExistingPageProvider() {}
- virtual SdPage* operator() (SdDrawDocument* pDocument);
- virtual int GetCostIndex (void);
- virtual bool operator== (const PageObjectProvider& rProvider);
-private:
- SdPage* mpPage;
-};
-
-} } } // end of namespace ::sd::toolpanel::controls
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/toolpanel/controls/MasterPageContainerQueue.cxx b/sd/source/ui/toolpanel/controls/MasterPageContainerQueue.cxx
deleted file mode 100644
index 5cca5051ab95..000000000000
--- a/sd/source/ui/toolpanel/controls/MasterPageContainerQueue.cxx
+++ /dev/null
@@ -1,300 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-
-#include "MasterPageContainerQueue.hxx"
-
-#include "tools/IdleDetection.hxx"
-
-#include <set>
-
-namespace sd { namespace toolpanel { namespace controls {
-
-const sal_Int32 MasterPageContainerQueue::snDelayedCreationTimeout (15);
-const sal_Int32 MasterPageContainerQueue::snDelayedCreationTimeoutWhenNotIdle (100);
-const sal_Int32 MasterPageContainerQueue::snMasterPagePriorityBoost (5);
-const sal_Int32 MasterPageContainerQueue::snWaitForMoreRequestsPriorityThreshold (-10);
-sal_uInt32 MasterPageContainerQueue::snWaitForMoreRequestsCount(15);
-
-//===== MasterPageContainerQueue::PreviewCreationRequest ======================
-
-class MasterPageContainerQueue::PreviewCreationRequest
-{
-public:
- PreviewCreationRequest (const SharedMasterPageDescriptor& rpDescriptor, int nPriority)
- : mpDescriptor(rpDescriptor),
- mnPriority(nPriority)
- {}
- SharedMasterPageDescriptor mpDescriptor;
- int mnPriority;
- class Compare
- {
- public:
- bool operator() (const PreviewCreationRequest& r1,const PreviewCreationRequest& r2) const
- {
- if (r1.mnPriority != r2.mnPriority)
- {
- // Prefer requests with higher priority.
- return r1.mnPriority > r2.mnPriority;
- }
- else
- {
- // Prefer tokens that have been earlier created (those with lower
- // value).
- return r1.mpDescriptor->maToken < r2.mpDescriptor->maToken;
- }
- }
- };
- class CompareToken
- {
- public:
- MasterPageContainer::Token maToken;
- CompareToken(MasterPageContainer::Token aToken) : maToken(aToken) {}
- bool operator() (const PreviewCreationRequest& rRequest) const
- { return maToken==rRequest.mpDescriptor->maToken; }
- };
-};
-
-
-
-
-//===== MasterPageContainerQueue::RequestQueue ================================
-
-class MasterPageContainerQueue::RequestQueue
- : public ::std::set<PreviewCreationRequest,PreviewCreationRequest::Compare>
-{
-public:
- RequestQueue (void) {}
-};
-
-
-
-
-//===== MasterPageContainerQueue ==============================================
-
-MasterPageContainerQueue* MasterPageContainerQueue::Create (
- const ::boost::weak_ptr<ContainerAdapter>& rpContainer)
-{
- MasterPageContainerQueue* pQueue = new MasterPageContainerQueue(rpContainer);
- pQueue->LateInit();
- return pQueue;
-}
-
-
-
-
-MasterPageContainerQueue::MasterPageContainerQueue (
- const ::boost::weak_ptr<ContainerAdapter>& rpContainer)
- : mpWeakContainer(rpContainer),
- mpRequestQueue(new RequestQueue()),
- maDelayedPreviewCreationTimer(),
- mnRequestsServedCount(0)
-{
-}
-
-
-
-
-MasterPageContainerQueue::~MasterPageContainerQueue (void)
-{
- maDelayedPreviewCreationTimer.Stop();
- while ( ! mpRequestQueue->empty())
- mpRequestQueue->erase(mpRequestQueue->begin());
-}
-
-
-
-
-void MasterPageContainerQueue::LateInit (void)
-{
- // Set up the timer for the delayed creation of preview bitmaps.
- maDelayedPreviewCreationTimer.SetTimeout (snDelayedCreationTimeout);
- Link aLink (LINK(this,MasterPageContainerQueue,DelayedPreviewCreation));
- maDelayedPreviewCreationTimer.SetTimeoutHdl(aLink);
-}
-
-
-
-
-bool MasterPageContainerQueue::RequestPreview (const SharedMasterPageDescriptor& rpDescriptor)
-{
- bool bSuccess (false);
- if (rpDescriptor.get() != NULL
- && rpDescriptor->maLargePreview.GetSizePixel().Width() == 0)
- {
- sal_Int32 nPriority (CalculatePriority(rpDescriptor));
-
- // Add a new or replace an existing request.
- RequestQueue::iterator iRequest (::std::find_if(
- mpRequestQueue->begin(),
- mpRequestQueue->end(),
- PreviewCreationRequest::CompareToken(rpDescriptor->maToken)));
- // When a request for the same token exists then the lowest of the
- // two priorities is used.
- if (iRequest != mpRequestQueue->end())
- if (iRequest->mnPriority < nPriority)
- {
- mpRequestQueue->erase(iRequest);
- iRequest = mpRequestQueue->end();
- }
-
- // Add a new request when none exists (or has just been erased).
- if (iRequest == mpRequestQueue->end())
- {
- mpRequestQueue->insert(PreviewCreationRequest(rpDescriptor,nPriority));
- maDelayedPreviewCreationTimer.Start();
- bSuccess = true;
- }
- }
- return bSuccess;
-}
-
-
-
-
-sal_Int32 MasterPageContainerQueue::CalculatePriority (
- const SharedMasterPageDescriptor& rpDescriptor) const
-{
- sal_Int32 nPriority;
-
- // The cost is used as a starting value.
- int nCost (0);
- if (rpDescriptor->mpPreviewProvider.get() != NULL)
- {
- nCost = rpDescriptor->mpPreviewProvider->GetCostIndex();
- if (rpDescriptor->mpPreviewProvider->NeedsPageObject())
- if (rpDescriptor->mpPageObjectProvider.get() != NULL)
- nCost += rpDescriptor->mpPageObjectProvider->GetCostIndex();
- }
-
- // Its negative value is used so that requests with a low cost are
- // preferred over those with high costs.
- nPriority = -nCost;
-
- // Add a term that introduces an order based on the appearance in the
- // AllMasterPagesSelector.
- nPriority -= rpDescriptor->maToken / 3;
-
- // Process requests for the CurrentMasterPagesSelector first.
- if (rpDescriptor->meOrigin == MasterPageContainer::MASTERPAGE)
- nPriority += snMasterPagePriorityBoost;
-
- return nPriority;
-}
-
-
-
-
-IMPL_LINK(MasterPageContainerQueue, DelayedPreviewCreation, Timer*, pTimer)
-{
- bool bIsShowingFullScreenShow (false);
- bool bWaitForMoreRequests (false);
-
- do
- {
- if (mpRequestQueue->empty())
- break;
-
- // First check whether the system is idle.
- sal_Int32 nIdleState (tools::IdleDetection::GetIdleState());
- if (nIdleState != tools::IdleDetection::IDET_IDLE)
- {
- if ((nIdleState&tools::IdleDetection::IDET_FULL_SCREEN_SHOW_ACTIVE) != 0)
- bIsShowingFullScreenShow = true;
- break;
- }
-
- PreviewCreationRequest aRequest (*mpRequestQueue->begin());
-
- // Check if the request should really be processed right now.
- // Reasons to not do it are when its cost is high and not many other
- // requests have been inserted into the queue that would otherwise
- // be processed first.
- if (aRequest.mnPriority < snWaitForMoreRequestsPriorityThreshold
- && (mnRequestsServedCount+mpRequestQueue->size() < snWaitForMoreRequestsCount))
- {
- // Wait for more requests before this one is processed. Note
- // that the queue processing is not started anew when this
- // method is left. That is done when the next request is
- // inserted.
- bWaitForMoreRequests = true;
- break;
- }
-
- mpRequestQueue->erase(mpRequestQueue->begin());
-
- if (aRequest.mpDescriptor.get() != NULL)
- {
- mnRequestsServedCount += 1;
- if ( ! mpWeakContainer.expired())
- {
- ::boost::shared_ptr<ContainerAdapter> pContainer (mpWeakContainer);
- if (pContainer.get() != NULL)
- pContainer->UpdateDescriptor(aRequest.mpDescriptor,false,true,true);
- }
- }
- }
- while (false);
-
- if (mpRequestQueue->size() > 0 && ! bWaitForMoreRequests)
- {
- int nTimeout (snDelayedCreationTimeout);
- if (bIsShowingFullScreenShow)
- nTimeout = snDelayedCreationTimeoutWhenNotIdle;
- maDelayedPreviewCreationTimer.SetTimeout(nTimeout);
- pTimer->Start();
- }
-
- return 0;
-}
-
-
-
-
-bool MasterPageContainerQueue::HasRequest (MasterPageContainer::Token aToken) const
-{
- RequestQueue::iterator iRequest (::std::find_if(
- mpRequestQueue->begin(),
- mpRequestQueue->end(),
- PreviewCreationRequest::CompareToken(aToken)));
- return (iRequest != mpRequestQueue->end());
-}
-
-
-
-
-bool MasterPageContainerQueue::IsEmpty (void) const
-{
- return mpRequestQueue->empty();
-}
-
-
-
-
-void MasterPageContainerQueue::ProcessAllRequests (void)
-{
- snWaitForMoreRequestsCount = 0;
- if (mpRequestQueue->size() > 0)
- maDelayedPreviewCreationTimer.Start();
-}
-
-
-} } } // end of namespace ::sd::toolpanel::controls
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/toolpanel/controls/MasterPageContainerQueue.hxx b/sd/source/ui/toolpanel/controls/MasterPageContainerQueue.hxx
deleted file mode 100644
index 258fbddd1d32..000000000000
--- a/sd/source/ui/toolpanel/controls/MasterPageContainerQueue.hxx
+++ /dev/null
@@ -1,134 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#ifndef SD_TOOLPANEL_CONTROLS_MASTER_PAGE_CONTAINER_QUEUE_HXX
-#define SD_TOOLPANEL_CONTROLS_MASTER_PAGE_CONTAINER_QUEUE_HXX
-
-#include "MasterPageContainer.hxx"
-#include "MasterPageDescriptor.hxx"
-
-#include <boost/scoped_ptr.hpp>
-#include <boost/weak_ptr.hpp>
-
-namespace sd { namespace toolpanel { namespace controls {
-
-
-/** The queue stores and processes all requests from a MasterPageContainer
- for the creation of previews.
- The order of request processing and its timing is controlled by a
- heuristic that uses values given with each request and which is
- controlled by various parameters that are described below.
-*/
-class MasterPageContainerQueue
-{
-public:
- class ContainerAdapter {
- public:
- virtual bool UpdateDescriptor (
- const SharedMasterPageDescriptor& rpDescriptor,
- bool bForcePageObject,
- bool bForcePreview,
- bool bSendEvents) = 0;
-
- protected:
- ~ContainerAdapter() {}
- };
-
- static MasterPageContainerQueue* Create (
- const ::boost::weak_ptr<ContainerAdapter>& rpContainer);
- virtual ~MasterPageContainerQueue (void);
-
- /** This method is typically called for entries in the container for
- which GetPreviewState() returns OS_CREATABLE. The creation of the
- preview is then scheduled to be executed asynchronously at a later
- point in time. When the preview is available the change listeners
- will be notified.
- */
- bool RequestPreview (const SharedMasterPageDescriptor& rDescriptor);
-
- /** Return <TRUE/> when there is a request currently in the queue for
- the given token.
- */
- bool HasRequest (MasterPageContainer::Token aToken) const;
-
- /** Return <TRUE/> when there is at least one request in the queue.
- */
- bool IsEmpty (void) const;
-
- /** After this call the queue does not wait anymore for requests with
- higher priority when only a small number of requests with lower
- priority are present. This method should be called when all
- templates are inserted into the MasterPageContainer.
- */
- void ProcessAllRequests (void);
-
-private:
- ::boost::weak_ptr<ContainerAdapter> mpWeakContainer;
- class PreviewCreationRequest;
- class RequestQueue;
- ::boost::scoped_ptr<RequestQueue> mpRequestQueue;
- Timer maDelayedPreviewCreationTimer;
- sal_uInt32 mnRequestsServedCount;
-
- // There are a couple of values that define various aspects of the
- // heuristic that defines the order and timing in which requests for
- // preview creation are processed.
-
- /** The time to wait (in milliseconds) between the creation of previews.
- */
- static const sal_Int32 snDelayedCreationTimeout;
-
- /** The time to wait when the system is not idle.
- */
- static const sal_Int32 snDelayedCreationTimeoutWhenNotIdle;
-
- /** Requests for previews of master pages in a document have their
- priority increased by this value.
- */
- static const sal_Int32 snMasterPagePriorityBoost;
-
- /** When only requests which a priority lower than this threshold exist
- and not many requests have been made yet then wait with processing
- them until more requests are present.
- */
- static const sal_Int32 snWaitForMoreRequestsPriorityThreshold;
-
- /** When only requests which a priority lower than a threshold exist
- and not more requests than this number have been made or already
- processed then wait with processing them until more requests are
- present.
- */
- static sal_uInt32 snWaitForMoreRequestsCount;
-
- MasterPageContainerQueue (const ::boost::weak_ptr<ContainerAdapter>& rpContainer);
- void LateInit (void);
-
- /** Calculate the priority that defines the order in which requests
- are processed.
- */
- sal_Int32 CalculatePriority (const SharedMasterPageDescriptor& rDescriptor) const;
-
- DECL_LINK(DelayedPreviewCreation, Timer *);
-};
-
-} } } // end of namespace ::sd::toolpanel::controls
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/toolpanel/controls/MasterPageDescriptor.cxx b/sd/source/ui/toolpanel/controls/MasterPageDescriptor.cxx
deleted file mode 100644
index 3ebeb3daad1e..000000000000
--- a/sd/source/ui/toolpanel/controls/MasterPageDescriptor.cxx
+++ /dev/null
@@ -1,416 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-
-#include "MasterPageDescriptor.hxx"
-
-#include "DocumentHelper.hxx"
-#include "sdpage.hxx"
-#include <tools/urlobj.hxx>
-
-namespace sd { namespace toolpanel { namespace controls {
-
-
-//===== MasterPageDescriptor ==================================================
-
-MasterPageDescriptor::MasterPageDescriptor (
- MasterPageContainer::Origin eOrigin,
- const sal_Int32 nTemplateIndex,
- const OUString& rsURL,
- const OUString& rsPageName,
- const OUString& rsStyleName,
- const bool bIsPrecious,
- const ::boost::shared_ptr<PageObjectProvider>& rpPageObjectProvider,
- const ::boost::shared_ptr<PreviewProvider>& rpPreviewProvider)
- : maToken(MasterPageContainer::NIL_TOKEN),
- meOrigin(eOrigin),
- msURL(INetURLObject(rsURL).GetMainURL(INetURLObject::DECODE_UNAMBIGUOUS)),
- msPageName(rsPageName),
- msStyleName(rsStyleName),
- mbIsPrecious(bIsPrecious),
- mpMasterPage(NULL),
- mpSlide(NULL),
- maSmallPreview(),
- maLargePreview(),
- mpPreviewProvider(rpPreviewProvider),
- mpPageObjectProvider(rpPageObjectProvider),
- mnTemplateIndex(nTemplateIndex),
- meURLClassification(URLCLASS_UNDETERMINED),
- mnUseCount(0)
-{
-}
-
-
-
-
-MasterPageDescriptor::MasterPageDescriptor (const MasterPageDescriptor& rDescriptor)
- : maToken(rDescriptor.maToken),
- meOrigin(rDescriptor.meOrigin),
- msURL(rDescriptor.msURL),
- msPageName(rDescriptor.msPageName),
- msStyleName(rDescriptor.msStyleName),
- mbIsPrecious(rDescriptor.mbIsPrecious),
- mpMasterPage(rDescriptor.mpMasterPage),
- mpSlide(rDescriptor.mpSlide),
- maSmallPreview(rDescriptor.maSmallPreview),
- maLargePreview(rDescriptor.maLargePreview),
- mpPreviewProvider(rDescriptor.mpPreviewProvider),
- mpPageObjectProvider(rDescriptor.mpPageObjectProvider),
- mnTemplateIndex(rDescriptor.mnTemplateIndex),
- meURLClassification(rDescriptor.meURLClassification),
- mnUseCount(rDescriptor.mnUseCount)
-{
-}
-
-
-
-
-MasterPageDescriptor::~MasterPageDescriptor (void)
-{
-}
-
-
-
-
-void MasterPageDescriptor::SetToken (MasterPageContainer::Token aToken)
-{
- maToken = aToken;
-}
-
-
-
-
-Image MasterPageDescriptor::GetPreview (MasterPageContainer::PreviewSize eSize) const
-{
- if (eSize == MasterPageContainer::SMALL)
- return maSmallPreview;
- else
- return maLargePreview;
-}
-
-
-
-SAL_WNODEPRECATED_DECLARATIONS_PUSH
-::std::auto_ptr<std::vector<MasterPageContainerChangeEvent::EventType> >
- MasterPageDescriptor::Update (
- const MasterPageDescriptor& rDescriptor)
-{
- bool bDataChanged (false);
- bool bIndexChanged (false);
- bool bPreviewChanged (false);
-
- if (meOrigin==MasterPageContainer::UNKNOWN
- && rDescriptor.meOrigin!=MasterPageContainer::UNKNOWN)
- {
- meOrigin = rDescriptor.meOrigin;
- bIndexChanged = true;
- }
-
- if (msURL.isEmpty() && !rDescriptor.msURL.isEmpty())
- {
- msURL = rDescriptor.msURL;
- bDataChanged = true;
- }
-
- if (msPageName.isEmpty() && !rDescriptor.msPageName.isEmpty())
- {
- msPageName = rDescriptor.msPageName;
- bDataChanged = true;
- }
-
- if (msStyleName.isEmpty() && !rDescriptor.msStyleName.isEmpty())
- {
- msStyleName = rDescriptor.msStyleName;
- bDataChanged = true;
- }
-
- if (mpPageObjectProvider.get()==NULL && rDescriptor.mpPageObjectProvider.get()!=NULL)
- {
- mpPageObjectProvider = rDescriptor.mpPageObjectProvider;
- bDataChanged = true;
- }
-
- if (mpPreviewProvider.get()==NULL && rDescriptor.mpPreviewProvider.get()!=NULL)
- {
- mpPreviewProvider = rDescriptor.mpPreviewProvider;
- bPreviewChanged = true;
- }
-
- if (mnTemplateIndex<0 && rDescriptor.mnTemplateIndex>=0)
- {
- mnTemplateIndex = rDescriptor.mnTemplateIndex;
- bIndexChanged = true;
- }
-
- // Prepare the list of event types that will be returned.
- ::std::auto_ptr<std::vector<MasterPageContainerChangeEvent::EventType> > pResult;
- if (bDataChanged || bIndexChanged || bPreviewChanged)
- {
- pResult.reset(new std::vector<MasterPageContainerChangeEvent::EventType>());
- if (bDataChanged)
- pResult->push_back(MasterPageContainerChangeEvent::DATA_CHANGED);
- if (bIndexChanged)
- pResult->push_back(MasterPageContainerChangeEvent::INDEX_CHANGED);
- if (bPreviewChanged)
- pResult->push_back(MasterPageContainerChangeEvent::PREVIEW_CHANGED);
- }
-
- return pResult;
-}
-SAL_WNODEPRECATED_DECLARATIONS_POP
-
-
-
-int MasterPageDescriptor::UpdatePageObject (
- sal_Int32 nCostThreshold,
- SdDrawDocument* pDocument)
-{
- int nModified = 0;
-
- // Update the page object when that is not yet known.
- if (mpMasterPage == NULL
- && mpPageObjectProvider.get()!=NULL
- && (nCostThreshold<0 || mpPageObjectProvider->GetCostIndex()<=nCostThreshold))
- {
- // Note that pDocument may be NULL.
-
- SdPage* pPage = (*mpPageObjectProvider)(pDocument);
- if (meOrigin == MasterPageContainer::MASTERPAGE)
- {
- mpMasterPage = pPage;
- if (mpMasterPage != NULL)
- mpMasterPage->SetPrecious(mbIsPrecious);
- }
- else
- {
- // Master pages from templates are copied into the local document.
- if (pDocument != NULL)
- mpMasterPage = DocumentHelper::CopyMasterPageToLocalDocument(*pDocument,pPage);
- mpSlide = DocumentHelper::GetSlideForMasterPage(mpMasterPage);
- }
-
- if (mpMasterPage != NULL)
- {
- // Update page name and style name.
- if (msPageName.isEmpty())
- msPageName = mpMasterPage->GetName();
- msStyleName = mpMasterPage->GetName();
-
- // Delete an existing substitution. The next request for a preview
- // will create the real one.
- maSmallPreview = Image();
- maLargePreview = Image();
- mpPreviewProvider = ::boost::shared_ptr<PreviewProvider>(new PagePreviewProvider());
- }
- else
- {
- DBG_ASSERT(false, "UpdatePageObject: master page is NULL");
- return -1;
- }
-
- nModified = 1;
- }
-
- return nModified;
-}
-
-
-
-
-bool MasterPageDescriptor::UpdatePreview (
- sal_Int32 nCostThreshold,
- const Size& rSmallSize,
- const Size& rLargeSize,
- ::sd::PreviewRenderer& rRenderer)
-{
- bool bModified (false);
-
- // Update the preview when that is not yet known.
- if (maLargePreview.GetSizePixel().Width()==0
- && mpPreviewProvider.get()!=NULL
- && (nCostThreshold<0 || mpPreviewProvider->GetCostIndex()<=nCostThreshold))
- {
- SdPage* pPage = mpSlide;
- if (pPage == NULL)
- {
- pPage = mpMasterPage;
- }
- maLargePreview = (*mpPreviewProvider)(
- rLargeSize.Width(),
- pPage,
- rRenderer);
- if (maLargePreview.GetSizePixel().Width() > 0)
- {
- // Create the small preview by scaling the large one down.
- maSmallPreview = rRenderer.ScaleBitmap(
- maLargePreview.GetBitmapEx(),
- rSmallSize.Width());
- // The large preview may not have the desired width. Scale it
- // accrodingly.
- if (maLargePreview.GetSizePixel().Width() != rLargeSize.Width())
- maLargePreview = rRenderer.ScaleBitmap(
- maLargePreview.GetBitmapEx(),
- rLargeSize.Width());
- bModified = true;
- }
- }
-
- return bModified;
-}
-
-
-
-
-MasterPageDescriptor::URLClassification MasterPageDescriptor::GetURLClassification (void)
-{
- if (meURLClassification == URLCLASS_UNDETERMINED)
- {
- if (msURL.isEmpty())
- meURLClassification = URLCLASS_UNKNOWN;
- else if (msURL.indexOf("presnt")>=0)
- {
- meURLClassification = URLCLASS_PRESENTATION;
- }
- else if (msURL.indexOf("layout")>=0)
- {
- meURLClassification = URLCLASS_LAYOUT;
- }
- else if (msURL.indexOf("educate")>=0)
- {
- meURLClassification = URLCLASS_OTHER;
- }
- else
- {
- meURLClassification = URLCLASS_USER;
- }
- }
-
- return meURLClassification;
-}
-
-
-
-//===== URLComparator =========================================================
-
-MasterPageDescriptor::URLComparator::URLComparator (const OUString& sURL)
- : msURL(sURL)
-{
-}
-
-
-
-
-bool MasterPageDescriptor::URLComparator::operator() (
- const SharedMasterPageDescriptor& rDescriptor)
-{
- if (rDescriptor.get() == NULL)
- return false;
- else
- return rDescriptor->msURL.equals(msURL);
-}
-
-
-
-
-// ===== StyleNameComparator ==================================================
-
-MasterPageDescriptor::StyleNameComparator::StyleNameComparator (const OUString& sStyleName)
- : msStyleName(sStyleName)
-{
-}
-
-
-
-
-bool MasterPageDescriptor::StyleNameComparator::operator() (
- const SharedMasterPageDescriptor& rDescriptor)
-{
- if (rDescriptor.get() == NULL)
- return false;
- else
- return rDescriptor->msStyleName.equals(msStyleName);
-}
-
-
-
-
-//===== PageObjectComparator ==================================================
-
-MasterPageDescriptor::PageObjectComparator::PageObjectComparator (const SdPage* pPageObject)
- : mpMasterPage(pPageObject)
-{
-}
-
-
-
-
-bool MasterPageDescriptor::PageObjectComparator::operator() (
- const SharedMasterPageDescriptor& rDescriptor)
-{
- if (rDescriptor.get() == NULL)
- return false;
- else
- return rDescriptor->mpMasterPage==mpMasterPage;
-}
-
-
-
-
-//===== AllComparator =========================================================
-
-MasterPageDescriptor::AllComparator::AllComparator(const SharedMasterPageDescriptor& rDescriptor)
- : mpDescriptor(rDescriptor)
-{
-}
-
-
-
-
-bool MasterPageDescriptor::AllComparator::operator() (const SharedMasterPageDescriptor&rDescriptor)
-{
- if (rDescriptor.get() == NULL)
- return false;
- else
- {
- // Take URL, page name, style name, and page object into account
- // when comparing two descriptors. When two descriptors are
- // identical in any of these values then there are thought of as
- // equivalent. Only the Origin has to be the same in both
- // descriptors.
- return
- mpDescriptor->meOrigin == rDescriptor->meOrigin
- && (
- (!mpDescriptor->msURL.isEmpty()
- && mpDescriptor->msURL.equals(rDescriptor->msURL))
- || (!mpDescriptor->msPageName.isEmpty()
- && mpDescriptor->msPageName.equals(rDescriptor->msPageName))
- || (!mpDescriptor->msStyleName.isEmpty()
- && mpDescriptor->msStyleName.equals(rDescriptor->msStyleName))
- || (mpDescriptor->mpMasterPage!=NULL
- && mpDescriptor->mpMasterPage==rDescriptor->mpMasterPage)
- || (mpDescriptor->mpPageObjectProvider.get()!=NULL
- && rDescriptor->mpPageObjectProvider.get()!=NULL
- && mpDescriptor->mpPageObjectProvider==rDescriptor->mpPageObjectProvider));
- }
-}
-
-
-} } } // end of namespace ::sd::toolpanel::controls
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/toolpanel/controls/MasterPageDescriptor.hxx b/sd/source/ui/toolpanel/controls/MasterPageDescriptor.hxx
deleted file mode 100644
index bf1beb452b7b..000000000000
--- a/sd/source/ui/toolpanel/controls/MasterPageDescriptor.hxx
+++ /dev/null
@@ -1,235 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#ifndef SD_TOOLPANEL_CONTROLS_MASTER_PAGE_DESCRIPTOR_HXX
-#define SD_TOOLPANEL_CONTROLS_MASTER_PAGE_DESCRIPTOR_HXX
-
-#include "MasterPageContainer.hxx"
-#include <boost/shared_ptr.hpp>
-
-namespace sd { namespace toolpanel { namespace controls {
-
-class PageObjectProvider;
-class PreviewProvider;
-
-class MasterPageDescriptor;
-typedef ::boost::shared_ptr<MasterPageDescriptor> SharedMasterPageDescriptor;
-
-/** A collection of data that is stored for every master page in the
- MasterpageContainer.
-*/
-class MasterPageDescriptor
-{
-public:
- MasterPageDescriptor (
- MasterPageContainer::Origin eOrigin,
- const sal_Int32 nTemplateIndex,
- const OUString& rURL,
- const OUString& rPageName,
- const OUString& rStyleName,
- const bool bIsPrecious,
- const ::boost::shared_ptr<PageObjectProvider>& rpPageObjectProvider,
- const ::boost::shared_ptr<PreviewProvider>& rpPreviewProvider);
- MasterPageDescriptor (const MasterPageDescriptor& rDescriptor);
- ~MasterPageDescriptor (void);
-
- void SetToken (MasterPageContainer::Token aToken);
-
- /** Update the called MasterPageDescriptor object with values from the
- given one. Only those values are updated that have default values
- in the called object and that have non-default values in the given
- one.
- @return
- Returns a list of event types for which event notifications have
- to be sent to listeners. The list may be empty or NULL.
- */
- ::std::auto_ptr<std::vector<MasterPageContainerChangeEvent::EventType> >
- Update (
- const MasterPageDescriptor& rDescriptor);
-
- /** This convenience method returns either a small or a large preview,
- depending on the given size specifier.
- Note that the previews are not created when they are not present.
- @return
- The returned preview may be empty.
- */
- Image GetPreview (MasterPageContainer::PreviewSize ePreviewSize) const;
-
- /** Use the PreviewProvider to get access to a preview of the master
- page.
-
- Note that this is only done, when either bForce is <TRUE/> or
- the PreviewProvider::GetCostIndex() returns 0.
-
- The small preview is created by scaling the large one, not by
- calling PreviewProvider::operator() a second time.
-
- It is the responsibility of the caller to call UpdatePageObject()
- before calling this method when the PreviewProvider can only work
- when the master page object is present, i.e. its NeedsPageObject()
- method returns <TRUE/>.
-
- @param nCostThreshold
- When this is zero or positive then the preview is created only
- when the preview provider has a cost equal to or smaller than
- this threshold. A negative value forces the preview to be
- created, regardless of the cost.
- @param rSmallSize
- Size of the small preview.
- @param rLargeSize
- Size of the large preview.
- @param rRenderer
- A PreviewRenderer object that may be used to create a preview.
- @return
- When the previews are successfully provided then <TRUE/> is
- returned.
- */
- bool UpdatePreview (
- sal_Int32 nCostThreshold,
- const Size& rSmallSize,
- const Size& rLargeSize,
- ::sd::PreviewRenderer& rRenderer);
-
- /** Use the PageObjectProvider to get access to the master page object.
-
- Note that this is only done, when either bForce is <TRUE/> or the
- PreviewProvider::GetCostIndex() returns 0.
-
- @param nCostThreshold
- When this is zero or positive then the page object is created
- only when the page object provider has a cost equal to or
- smaller than this threshold. A negative value forces the
- page object be created, regardless of the cost.
- @param pDocument
- This document of the MasterPageContainer may be used to create
- a page object with or store one in.
- @return
- When the master page object is successfully provided then
- 1 is returned, on no change then a 0 is provided,
- on a masterpage-error a -1 is provided.
- */
- int UpdatePageObject (
- sal_Int32 nCostThreshold,
- SdDrawDocument* pDocument);
-
- enum URLClassification {
- URLCLASS_USER,
- URLCLASS_LAYOUT,
- URLCLASS_PRESENTATION,
- URLCLASS_OTHER,
- URLCLASS_UNKNOWN,
- URLCLASS_UNDETERMINED
- };
-
- URLClassification GetURLClassification (void);
-
- /** The Token under which the MasterPageContainer gives access to the
- object.
- */
- MasterPageContainer::Token maToken;
-
- /** A rough specification of the origin of the master page.
- */
- MasterPageContainer::Origin meOrigin;
-
- /** The URL is not empty for master pages loaded from a template
- document.
- */
- OUString msURL;
-
- /** Taken from the title of the template file.
- */
- OUString msPageName;
-
- /** Taken from the master page object.
- */
- OUString msStyleName;
-
- const bool mbIsPrecious;
-
- /** The actual master page.
- */
- SdPage* mpMasterPage;
-
- /** A slide that uses the master page.
- */
- SdPage* mpSlide;
-
- /** A small (the default size) preview of the master page. May be
- empty. When this smaller preview is not empty then the larger one
- is not empty, too.
- */
- Image maSmallPreview;
-
- /** A large preview of the master page. May be empty. When this larger
- preview is not empty then the smaller one is not empty, too.
- */
- Image maLargePreview;
-
- /** The prewview provider. May be empty. May be replaced during the
- lifetime of a MasterPageDescriptor object.
- */
- ::boost::shared_ptr<PreviewProvider> mpPreviewProvider;
-
- /** The master page provider. May be empty. May be replaced during
- the lifetime of a MasterPageDescriptor object.
- */
- ::boost::shared_ptr<PageObjectProvider> mpPageObjectProvider;
-
- /** This index represents the order in which templates are provided via
- the TemplateScanner. It defines the order in which the entries in
- the AllMasterPagesSelector are displayed. The default value is -1.
- */
- sal_Int32 mnTemplateIndex;
-
- URLClassification meURLClassification;
-
- sal_Int32 mnUseCount;
-
- class URLComparator { public:
- OUString msURL;
- URLComparator (const OUString& sURL);
- bool operator() (const SharedMasterPageDescriptor& rDescriptor);
- };
- class StyleNameComparator { public:
- OUString msStyleName;
- StyleNameComparator (const OUString& sStyleName);
- bool operator() (const SharedMasterPageDescriptor& rDescriptor);
- };
- class PageObjectComparator { public:
- const SdPage* mpMasterPage;
- PageObjectComparator (const SdPage* pPageObject);
- bool operator() (const SharedMasterPageDescriptor& rDescriptor);
- };
- class AllComparator { public:
- AllComparator(const SharedMasterPageDescriptor& rDescriptor);
- bool operator() (const SharedMasterPageDescriptor& rDescriptor);
- private:
- SharedMasterPageDescriptor mpDescriptor;
- };
-
-
-};
-
-
-} } } // end of namespace ::sd::toolpanel::controls
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/toolpanel/controls/MasterPageObserver.cxx b/sd/source/ui/toolpanel/controls/MasterPageObserver.cxx
deleted file mode 100644
index 6becbce4f862..000000000000
--- a/sd/source/ui/toolpanel/controls/MasterPageObserver.cxx
+++ /dev/null
@@ -1,415 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-
-#include "MasterPageObserver.hxx"
-
-#include <algorithm>
-#include "drawdoc.hxx"
-#include "sdpage.hxx"
-#include <boost/unordered_map.hpp>
-#include <set>
-#include <vector>
-#include <svl/lstner.hxx>
-#include <osl/doublecheckedlocking.h>
-#include <osl/getglobalmutex.hxx>
-
-
-namespace sd {
-
-class MasterPageObserver::Implementation
- : public SfxListener
-{
-public:
- /** The single instance of this class. It is created on demand when
- Instance() is called for the first time.
- */
- static MasterPageObserver* mpInstance;
-
- /** The master page observer will listen to events of this document and
- detect changes of the use of master pages.
- */
- void RegisterDocument (SdDrawDocument& rDocument);
-
- /** The master page observer will stop to listen to events of this
- document.
- */
- void UnregisterDocument (SdDrawDocument& rDocument);
-
- /** Add a listener that is informed of master pages that are newly
- assigned to slides or become unassigned.
- @param rEventListener
- The event listener to call for future events. Call
- RemoveEventListener() before the listener is destroyed.
- */
- void AddEventListener (const Link& rEventListener);
-
- /** Remove the given listener from the list of listeners.
- @param rEventListener
- After this method returns the given listener is not called back
- from this object. Passing a listener that has not
- been registered before is safe and is silently ignored.
- */
- void RemoveEventListener (const Link& rEventListener);
-
- /** Return a set of the names of master pages for the given document.
- This convenience method exists because this set is part of the
- internal data structure and thus takes no time to create.
- */
- inline MasterPageObserver::MasterPageNameSet GetMasterPageNames (
- SdDrawDocument& rDocument);
-
-private:
- ::std::vector<Link> maListeners;
-
- struct DrawDocHash {
- size_t operator()(SdDrawDocument* argument) const
- { return reinterpret_cast<sal_uIntPtr>(argument); }
- };
- typedef ::boost::unordered_map<SdDrawDocument*,
- MasterPageObserver::MasterPageNameSet,
- DrawDocHash>
- MasterPageContainer;
- MasterPageContainer maUsedMasterPages;
-
- virtual void Notify(
- SfxBroadcaster& rBroadcaster,
- const SfxHint& rHint);
-
- void AnalyzeUsedMasterPages (SdDrawDocument& rDocument);
-
- void SendEvent (MasterPageObserverEvent& rEvent);
-};
-
-MasterPageObserver* MasterPageObserver::Implementation::mpInstance = NULL;
-
-
-
-//===== MasterPageObserver ====================================================
-
-MasterPageObserver& MasterPageObserver::Instance (void)
-{
- if (Implementation::mpInstance == NULL)
- {
- ::osl::GetGlobalMutex aMutexFunctor;
- ::osl::MutexGuard aGuard (aMutexFunctor());
- if (Implementation::mpInstance == NULL)
- {
- MasterPageObserver* pInstance = new MasterPageObserver ();
- SdGlobalResourceContainer::Instance().AddResource (
- ::std::auto_ptr<SdGlobalResource>(pInstance));
- OSL_DOUBLE_CHECKED_LOCKING_MEMORY_BARRIER();
- Implementation::mpInstance = pInstance;
- }
- }
- else
- {
- OSL_DOUBLE_CHECKED_LOCKING_MEMORY_BARRIER();
- }
-
- DBG_ASSERT(Implementation::mpInstance!=NULL,
- "MasterPageObserver::Instance(): instance is NULL");
- return *Implementation::mpInstance;
-}
-
-
-
-
-void MasterPageObserver::RegisterDocument (SdDrawDocument& rDocument)
-{
- mpImpl->RegisterDocument (rDocument);
-}
-
-
-
-
-void MasterPageObserver::UnregisterDocument (SdDrawDocument& rDocument)
-{
- mpImpl->UnregisterDocument (rDocument);
-}
-
-
-
-
-void MasterPageObserver::AddEventListener (const Link& rEventListener)
-{
-
- mpImpl->AddEventListener (rEventListener);
-}
-
-
-
-
-void MasterPageObserver::RemoveEventListener (const Link& rEventListener)
-{
- mpImpl->RemoveEventListener (rEventListener);
-}
-
-
-
-
-MasterPageObserver::MasterPageObserver (void)
- : mpImpl (new Implementation())
-{}
-
-
-
-
-MasterPageObserver::~MasterPageObserver (void)
-{}
-
-
-
-
-//===== MasterPageObserver::Implementation ====================================
-
-void MasterPageObserver::Implementation::RegisterDocument (
- SdDrawDocument& rDocument)
-{
- // Gather the names of all the master pages in the given document.
- MasterPageContainer::mapped_type aMasterPageSet;
- sal_uInt16 nMasterPageCount = rDocument.GetMasterSdPageCount(PK_STANDARD);
- for (sal_uInt16 nIndex=0; nIndex<nMasterPageCount; nIndex++)
- {
- SdPage* pMasterPage = rDocument.GetMasterSdPage (nIndex, PK_STANDARD);
- if (pMasterPage != NULL)
- aMasterPageSet.insert (pMasterPage->GetName());
- }
-
- maUsedMasterPages[&rDocument] = aMasterPageSet;
-
- StartListening (rDocument);
-}
-
-
-
-
-void MasterPageObserver::Implementation::UnregisterDocument (
- SdDrawDocument& rDocument)
-{
- EndListening (rDocument);
-
- MasterPageContainer::iterator aMasterPageDescriptor(maUsedMasterPages.find(&rDocument));
- if(aMasterPageDescriptor != maUsedMasterPages.end())
- maUsedMasterPages.erase(aMasterPageDescriptor);
-}
-
-
-
-
-void MasterPageObserver::Implementation::AddEventListener (
- const Link& rEventListener)
-{
- if (::std::find (
- maListeners.begin(),
- maListeners.end(),
- rEventListener) == maListeners.end())
- {
- maListeners.push_back (rEventListener);
-
- // Tell the new listener about all the master pages that are
- // currently in use.
- MasterPageContainer::iterator aDocumentIterator;
- for (aDocumentIterator=maUsedMasterPages.begin();
- aDocumentIterator!=maUsedMasterPages.end();
- ++aDocumentIterator)
- {
- ::std::set<String>::reverse_iterator aNameIterator;
- for (aNameIterator=aDocumentIterator->second.rbegin();
- aNameIterator!=aDocumentIterator->second.rend();
- ++aNameIterator)
- {
- MasterPageObserverEvent aEvent (
- MasterPageObserverEvent::ET_MASTER_PAGE_EXISTS,
- *aDocumentIterator->first,
- *aNameIterator);
- SendEvent (aEvent);
- }
- }
- }
-}
-
-
-
-
-void MasterPageObserver::Implementation::RemoveEventListener (
- const Link& rEventListener)
-{
- maListeners.erase (
- ::std::find (
- maListeners.begin(),
- maListeners.end(),
- rEventListener));
-}
-
-
-
-
-MasterPageObserver::MasterPageNameSet
- MasterPageObserver::Implementation::GetMasterPageNames (
- SdDrawDocument& rDocument)
-{
- MasterPageContainer::iterator aMasterPageDescriptor (
- maUsedMasterPages.find(&rDocument));
- if (aMasterPageDescriptor != maUsedMasterPages.end())
- return aMasterPageDescriptor->second;
- else
- // Not found so return an empty set.
- return MasterPageObserver::MasterPageNameSet();
-}
-
-
-
-
-void MasterPageObserver::Implementation::Notify(
- SfxBroadcaster& rBroadcaster,
- const SfxHint& rHint)
-{
- if (rHint.ISA(SdrHint))
- {
- SdrHint& rSdrHint (*PTR_CAST(SdrHint,&rHint));
- switch (rSdrHint.GetKind())
- {
- case HINT_PAGEORDERCHG:
- // Process the modified set of pages only when the number of
- // standard and notes master pages are equal. This test
- // filters out events that are sent in between the insertion
- // of a new standard master page and a new notes master
- // page.
- if (rBroadcaster.ISA(SdDrawDocument))
- {
- SdDrawDocument& rDocument (
- static_cast<SdDrawDocument&>(rBroadcaster));
- if (rDocument.GetMasterSdPageCount(PK_STANDARD)
- == rDocument.GetMasterSdPageCount(PK_NOTES))
- {
- AnalyzeUsedMasterPages (rDocument);
- }
- }
- break;
-
- default:
- break;
- }
- }
-}
-
-
-
-
-void MasterPageObserver::Implementation::AnalyzeUsedMasterPages (
- SdDrawDocument& rDocument)
-{
- // Create a set of names of the master pages used by the given document.
- sal_uInt16 nMasterPageCount = rDocument.GetMasterSdPageCount(PK_STANDARD);
- ::std::set<String> aCurrentMasterPages;
- for (sal_uInt16 nIndex=0; nIndex<nMasterPageCount; nIndex++)
- {
- SdPage* pMasterPage = rDocument.GetMasterSdPage (nIndex, PK_STANDARD);
- if (pMasterPage != NULL)
- aCurrentMasterPages.insert (pMasterPage->GetName());
- OSL_TRACE("currently used master page %d is %s",
- nIndex,
- OUStringToOString(pMasterPage->GetName(),
- RTL_TEXTENCODING_UTF8).getStr());
- }
-
- typedef ::std::vector<String> StringList;
- StringList aNewMasterPages;
- StringList aRemovedMasterPages;
- MasterPageContainer::iterator aOldMasterPagesDescriptor (
- maUsedMasterPages.find(&rDocument));
- if (aOldMasterPagesDescriptor != maUsedMasterPages.end())
- {
- StringList::iterator I;
-
- ::std::set<String>::iterator J;
- int i=0;
- for (J=aOldMasterPagesDescriptor->second.begin();
- J!=aOldMasterPagesDescriptor->second.end();
- ++J)
- OSL_TRACE("old used master page %d is %s",
- i++,
- OUStringToOString(*J,
- RTL_TEXTENCODING_UTF8).getStr());
-
- // Send events about the newly used master pages.
- ::std::set_difference (
- aCurrentMasterPages.begin(),
- aCurrentMasterPages.end(),
- aOldMasterPagesDescriptor->second.begin(),
- aOldMasterPagesDescriptor->second.end(),
- ::std::back_insert_iterator<StringList>(aNewMasterPages));
- for (I=aNewMasterPages.begin(); I!=aNewMasterPages.end(); ++I)
- {
- OSL_TRACE(" added master page %s",
- OUStringToOString(*I,
- RTL_TEXTENCODING_UTF8).getStr());
-
- MasterPageObserverEvent aEvent (
- MasterPageObserverEvent::ET_MASTER_PAGE_ADDED,
- rDocument,
- *I);
- SendEvent (aEvent);
- }
-
- // Send events about master pages that are not used any longer.
- ::std::set_difference (
- aOldMasterPagesDescriptor->second.begin(),
- aOldMasterPagesDescriptor->second.end(),
- aCurrentMasterPages.begin(),
- aCurrentMasterPages.end(),
- ::std::back_insert_iterator<StringList>(aRemovedMasterPages));
- for (I=aRemovedMasterPages.begin(); I!=aRemovedMasterPages.end(); ++I)
- {
- OSL_TRACE(" removed master page %s",
- OUStringToOString(*I,
- RTL_TEXTENCODING_UTF8).getStr());
-
- MasterPageObserverEvent aEvent (
- MasterPageObserverEvent::ET_MASTER_PAGE_REMOVED,
- rDocument,
- *I);
- SendEvent (aEvent);
- }
-
- // Store the new list of master pages.
- aOldMasterPagesDescriptor->second = aCurrentMasterPages;
- }
-}
-
-
-
-
-void MasterPageObserver::Implementation::SendEvent (
- MasterPageObserverEvent& rEvent)
-{
- ::std::vector<Link>::iterator aLink (maListeners.begin());
- ::std::vector<Link>::iterator aEnd (maListeners.end());
- while (aLink!=aEnd)
- {
- aLink->Call (&rEvent);
- ++aLink;
- }
-}
-
-
-} // end of namespace sd
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/toolpanel/controls/MasterPagesPanel.cxx b/sd/source/ui/toolpanel/controls/MasterPagesPanel.cxx
deleted file mode 100644
index 4acb64dee204..000000000000
--- a/sd/source/ui/toolpanel/controls/MasterPagesPanel.cxx
+++ /dev/null
@@ -1,148 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-
-#include "MasterPagesPanel.hxx"
-#include "taskpane/ScrollPanel.hxx"
-#include "CurrentMasterPagesSelector.hxx"
-#include "RecentMasterPagesSelector.hxx"
-#include "AllMasterPagesSelector.hxx"
-#include "taskpane/ToolPanelViewShell.hxx"
-#include "taskpane/TaskPaneControlFactory.hxx"
-#include "taskpane/TitledControl.hxx"
-#include "../TaskPaneShellManager.hxx"
-
-#include "DrawViewShell.hxx"
-#include "ViewShellBase.hxx"
-
-#include "strings.hrc"
-#include "sdresid.hxx"
-#include "helpids.h"
-#include "app.hrc"
-
-namespace sd { namespace toolpanel { namespace controls {
-
-
-MasterPagesPanel::MasterPagesPanel (::Window& i_rParentWindow, ToolPanelViewShell& i_rPanelViewShell)
- :ScrollPanel (i_rParentWindow)
- ,m_pPanelViewShell( &i_rPanelViewShell )
-{
- impl_construct( m_pPanelViewShell->GetViewShellBase() );
-}
-
-void MasterPagesPanel::impl_construct( ViewShellBase& rBase )
-{
- SdDrawDocument* pDocument = rBase.GetDocument();
- ::std::auto_ptr<controls::MasterPagesSelector> pSelector;
-
- ::boost::shared_ptr<MasterPageContainer> pContainer (new MasterPageContainer());
-
- // Create a panel with the master pages that are in use by the currently
- // edited document.
- DrawViewShell* pDrawViewShell = dynamic_cast<DrawViewShell*>(rBase.GetMainViewShell().get());
- pSelector.reset(new controls::CurrentMasterPagesSelector (
- this,
- *pDocument,
- rBase,
- pContainer));
- pSelector->LateInit();
- pSelector->SetHelpId( HID_SD_TASK_PANE_PREVIEW_CURRENT );
- GetShellManager()->AddSubShell(
- SHELLID_SD_TASK_PANE_PREVIEW_CURRENT,
- pSelector.get(),
- pSelector->GetWindow());
- AddControl (
- ::std::auto_ptr<TreeNode>(pSelector.release()),
- SdResId(STR_TASKPANEL_CURRENT_MASTER_PAGES_TITLE),
- HID_SD_CURRENT_MASTERS);
-
- // Create a panel with the most recently used master pages.
- pSelector.reset(new controls::RecentMasterPagesSelector (
- this,
- *pDocument,
- rBase,
- pContainer));
- pSelector->LateInit();
- pSelector->SetHelpId( HID_SD_TASK_PANE_PREVIEW_RECENT );
- GetShellManager()->AddSubShell(
- SHELLID_SD_TASK_PANE_PREVIEW_RECENT,
- pSelector.get(),
- pSelector->GetWindow());
- AddControl (
- ::std::auto_ptr<TreeNode>(pSelector.release()),
- SdResId(STR_TASKPANEL_RECENT_MASTER_PAGES_TITLE),
- HID_SD_RECENT_MASTERS);
-
- // Create a panel with all available master pages.
- pSelector.reset(new controls::AllMasterPagesSelector (
- this,
- *pDocument,
- rBase,
- *pDrawViewShell,
- pContainer));
- pSelector->LateInit();
- pSelector->SetHelpId( HID_SD_TASK_PANE_PREVIEW_ALL );
- GetShellManager()->AddSubShell(
- SHELLID_SD_TASK_PANE_PREVIEW_ALL,
- pSelector.get(),
- pSelector->GetWindow());
- AddControl (
- ::std::auto_ptr<TreeNode>(pSelector.release()),
- SdResId(STR_TASKPANEL_ALL_MASTER_PAGES_TITLE),
- HID_SD_ALL_MASTERS);
-}
-
-
-
-
-
-MasterPagesPanel::~MasterPagesPanel (void)
-{
- TaskPaneShellManager* pShellManager( GetShellManager() );
- OSL_ENSURE( pShellManager, "MasterPagesPanel::~MasterPagesPanel: no shell manager anymore - cannot remove sub shells!" );
- if ( pShellManager )
- {
- pShellManager->RemoveSubShell( SHELLID_SD_TASK_PANE_PREVIEW_CURRENT );
- pShellManager->RemoveSubShell( SHELLID_SD_TASK_PANE_PREVIEW_RECENT );
- pShellManager->RemoveSubShell( SHELLID_SD_TASK_PANE_PREVIEW_ALL );
- }
-}
-
-
-
-
-TaskPaneShellManager* MasterPagesPanel::GetShellManager()
-{
- if ( m_pPanelViewShell )
- return &m_pPanelViewShell->GetSubShellManager();
- return TreeNode::GetShellManager();
-}
-
-
-
-
-std::auto_ptr< ControlFactory > MasterPagesPanel::CreateControlFactory( ToolPanelViewShell& i_rToolPanelShell )
-{
- return std::auto_ptr< ControlFactory >(
- new RootControlFactoryWithArg< MasterPagesPanel, ToolPanelViewShell >( i_rToolPanelShell ) );
-}
-
-} } } // end of namespace ::sd::toolpanel::controls
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/toolpanel/controls/MasterPagesPanel.hxx b/sd/source/ui/toolpanel/controls/MasterPagesPanel.hxx
deleted file mode 100644
index 5e6d45f46524..000000000000
--- a/sd/source/ui/toolpanel/controls/MasterPagesPanel.hxx
+++ /dev/null
@@ -1,66 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#ifndef SD_TASKPANE_CONTROLS_MASTER_PAGES_PANEL_HXX
-#define SD_TASKPANE_CONTROLS_MASTER_PAGES_PANEL_HXX
-
-#include "taskpane/ScrollPanel.hxx"
-
-namespace sd {
-class ViewShellBase;
-}
-
-namespace sd { namespace toolpanel {
-class ControlFactory;
-class TreeNode;
-class ToolPanelViewShell;
-} }
-
-namespace sd { namespace toolpanel { namespace controls {
-
-/** The master pages panel combines three master page related panels into
- one. This has the benefit that creation of the task pane becomes a
- little bit simpler and that common scroll bars can be displayed.
-*/
-class MasterPagesPanel
- : public ScrollPanel
-{
-public:
- MasterPagesPanel (
- ::Window& i_rParentWindow,
- ToolPanelViewShell& i_rPanelViewShell);
- virtual ~MasterPagesPanel (void);
-
- // TreeNode overridables
- virtual TaskPaneShellManager* GetShellManager (void);
-
- static std::auto_ptr<ControlFactory> CreateControlFactory (ToolPanelViewShell& i_rToolPanelShell);
-
-private:
- void impl_construct( ViewShellBase& rBase );
-
-private:
- ToolPanelViewShell* m_pPanelViewShell;
-};
-
-} } } // end of namespace ::sd::toolpanel::controls
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/toolpanel/controls/MasterPagesSelector.cxx b/sd/source/ui/toolpanel/controls/MasterPagesSelector.cxx
deleted file mode 100644
index cc806ca416be..000000000000
--- a/sd/source/ui/toolpanel/controls/MasterPagesSelector.cxx
+++ /dev/null
@@ -1,842 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-
-#include "MasterPagesSelector.hxx"
-
-#include "MasterPageContainer.hxx"
-#include "DocumentHelper.hxx"
-#include "pres.hxx"
-#include "drawdoc.hxx"
-#include "DrawDocShell.hxx"
-#include "sdpage.hxx"
-#include "glob.hxx"
-#include "glob.hrc"
-#include "app.hrc"
-#include "res_bmp.hrc"
-#include "strings.hrc"
-#include "DrawViewShell.hxx"
-#include "DrawController.hxx"
-#include "SlideSorterViewShell.hxx"
-#include "PreviewValueSet.hxx"
-#include "ViewShellBase.hxx"
-#include "../TaskPaneShellManager.hxx"
-#include "taskpane/TitledControl.hxx"
-#include "taskpane/ControlContainer.hxx"
-#include "controller/SlideSorterController.hxx"
-#include "controller/SlsPageSelector.hxx"
-#include <sfx2/objface.hxx>
-#include "sdresid.hxx"
-#include "TemplateScanner.hxx"
-#include "drawview.hxx"
-#include <vcl/image.hxx>
-#include <svl/languageoptions.hxx>
-#include <sfx2/app.hxx>
-#include <sfx2/dispatch.hxx>
-#include <sfx2/mnumgr.hxx>
-#include <svl/itemset.hxx>
-#include <svl/eitem.hxx>
-#include <svx/dlgutil.hxx>
-#include <svx/svdpagv.hxx>
-#include <svx/svxids.hrc>
-#include "FrameView.hxx"
-#include "stlpool.hxx"
-#include "unmovss.hxx"
-#include <sfx2/request.hxx>
-#include <svl/itempool.hxx>
-
-using namespace ::sd::toolpanel::controls;
-#define MasterPagesSelector
-#include "sdslots.hxx"
-
-using namespace ::com::sun::star::text;
-
-
-
-namespace sd { namespace toolpanel { namespace controls {
-
-
-SFX_IMPL_INTERFACE(MasterPagesSelector, SfxShell,
- SdResId(STR_MASTERPAGESSELECTOR))
-{
- SFX_POPUPMENU_REGISTRATION( SdResId(RID_TASKPANE_MASTERPAGESSELECTOR_POPUP) );
-}
-
-TYPEINIT1(MasterPagesSelector, SfxShell);
-
-
-
-MasterPagesSelector::MasterPagesSelector (
- TreeNode* pParent,
- SdDrawDocument& rDocument,
- ViewShellBase& rBase,
- const ::boost::shared_ptr<MasterPageContainer>& rpContainer)
- : TreeNode (pParent),
- SfxShell(),
- maMutex(),
- mpContainer(rpContainer),
- mrDocument(rDocument),
- mpPageSet (new PreviewValueSet(pParent)),
- mrBase(rBase),
- mnDefaultClickAction(SID_TP_APPLY_TO_ALL_SLIDES),
- maPreviewUpdateQueue(),
- maCurrentItemList(),
- maTokenToValueSetIndex(),
- maLockedMasterPages()
-{
- SetPool (&rDocument.GetPool());
-
- mpPageSet->SetSelectHdl (
- LINK(this, MasterPagesSelector, ClickHandler));
- mpPageSet->SetRightMouseClickHandler (
- LINK(this, MasterPagesSelector, RightClickHandler));
- mpPageSet->SetContextMenuCallback (
- LINK(this, MasterPagesSelector, ContextMenuCallback));
- mpPageSet->SetStyle(mpPageSet->GetStyle() | WB_NO_DIRECTSELECT);
- mpPageSet->SetPreviewSize(mpContainer->GetPreviewSizePixel());
- mpPageSet->Show();
-
- Link aChangeListener (LINK(this,MasterPagesSelector,ContainerChangeListener));
- mpContainer->AddChangeListener(aChangeListener);
-}
-
-
-
-
-MasterPagesSelector::~MasterPagesSelector (void)
-{
- Clear();
- mpPageSet.reset();
- UpdateLocks(ItemList());
-
- if (GetShellManager() != NULL)
- GetShellManager()->RemoveSubShell (this);
-
- Link aChangeListener (LINK(this,MasterPagesSelector,ContainerChangeListener));
- mpContainer->RemoveChangeListener(aChangeListener);
-}
-
-
-
-
-void MasterPagesSelector::LateInit (void)
-{
-}
-
-
-
-
-sal_Int32 MasterPagesSelector::GetPreferredWidth (sal_Int32 nHeight)
-{
- const ::osl::MutexGuard aGuard (maMutex);
-
- return mpPageSet->GetPreferredWidth (nHeight);
-}
-
-
-
-
-sal_Int32 MasterPagesSelector::GetPreferredHeight (sal_Int32 nWidth)
-{
- const ::osl::MutexGuard aGuard (maMutex);
-
- return mpPageSet->GetPreferredHeight (nWidth);
-}
-
-
-
-
-Size MasterPagesSelector::GetPreferredSize (void)
-{
- int nPreferredWidth = GetPreferredWidth(
- mpPageSet->GetOutputSizePixel().Height());
- int nPreferredHeight = GetPreferredHeight(nPreferredWidth);
- return Size (nPreferredWidth, nPreferredHeight);
-
-}
-
-
-
-
-void MasterPagesSelector::UpdateLocks (const ItemList& rItemList)
-{
- ItemList aNewLockList;
-
- // In here we first lock the master pages in the given list and then
- // release the locks acquired in a previous call to this method. When
- // this were done the other way round the lock count of some master
- // pages might drop temporarily to 0 and would lead to unnecessary
- // deletion and re-creation of MasterPageDescriptor objects.
-
- // Lock the master pages in the given list.
- ItemList::const_iterator iItem;
- for (iItem=rItemList.begin(); iItem!=rItemList.end(); ++iItem)
- {
- mpContainer->AcquireToken(*iItem);
- aNewLockList.push_back(*iItem);
- }
-
- // Release the previously locked master pages.
- ItemList::const_iterator iPage;
- ItemList::const_iterator iEnd (maLockedMasterPages.end());
- for (iPage=maLockedMasterPages.begin(); iPage!=iEnd; ++iPage)
- mpContainer->ReleaseToken(*iPage);
-
- maLockedMasterPages.swap(aNewLockList);
-}
-
-
-
-
-void MasterPagesSelector::Fill (void)
-{
- ::std::auto_ptr<ItemList> pItemList (new ItemList());
-
- Fill(*pItemList);
-
- UpdateLocks(*pItemList);
- UpdateItemList(pItemList);
-}
-
-
-
-
-ResId MasterPagesSelector::GetContextMenuResId (void) const
-{
- return SdResId(RID_TASKPANE_MASTERPAGESSELECTOR_POPUP);
-}
-
-
-
-
-IMPL_LINK_NOARG(MasterPagesSelector, ClickHandler)
-{
- // We use the framework to assign the clicked-on master page because we
- // so use the same mechanism as the context menu does (where we do not
- // have the option to call the assignment method directly.)
- if (GetShellManager() != NULL)
- GetShellManager()->MoveToTop (this);
-
- SfxViewFrame* pViewFrame = mrBase.GetViewFrame();
- if (pViewFrame != NULL)
- {
- SfxDispatcher* pDispatcher = pViewFrame->GetDispatcher();
- if (pDispatcher != NULL)
- pDispatcher->Execute(mnDefaultClickAction);
- }
-
- return 0;
-}
-
-
-
-
-IMPL_LINK(MasterPagesSelector, RightClickHandler, MouseEvent*, pEvent)
-{
- // Here we only prepare the display of the context menu: the item under
- // the mouse is selected. The actual display of the context menu is
- // done in ContextMenuCallback which is called indirectly through
- // PreviewValueSet::Command().
- mpPageSet->GrabFocus ();
- mpPageSet->ReleaseMouse();
- if (GetDispatcher() != NULL && pEvent != NULL)
- {
- sal_uInt16 nIndex = mpPageSet->GetItemId (pEvent->GetPosPixel());
- if (nIndex > 0)
- mpPageSet->SelectItem (nIndex);
- }
- return 0;
-}
-
-
-
-
-IMPL_LINK(MasterPagesSelector, ContextMenuCallback, CommandEvent*, pEvent)
-{
- // Use the currently selected item and show the popup menu in its
- // center.
- if (GetShellManager() != NULL)
- GetShellManager()->MoveToTop (this);
- const sal_uInt16 nIndex = mpPageSet->GetSelectItemId();
- if (nIndex > 0 && pEvent!=NULL)
- {
- // The position of the upper left corner of the context menu is
- // taken either from the mouse position (when the command was sent
- // as reaction to a right click) or in the center of the selected
- // item (when the command was sent as reaction to Shift+F10.)
- Point aPosition (pEvent->GetMousePosPixel());
- if ( ! pEvent->IsMouseEvent())
- {
- Rectangle aBBox (mpPageSet->GetItemRect(nIndex));
- aPosition = aBBox.Center();
- }
-
- const ResId aPopupResId (GetContextMenuResId());
- mrBase.GetViewFrame()->GetDispatcher()->ExecutePopup(
- aPopupResId,
- mpPageSet.get(),
- &aPosition);
- }
-
- return 0;
-}
-
-
-
-
-IMPL_LINK(MasterPagesSelector, ContainerChangeListener, MasterPageContainerChangeEvent*, pEvent)
-{
- if (pEvent)
- NotifyContainerChangeEvent(*pEvent);
- return 0;
-}
-
-
-
-
-SdPage* MasterPagesSelector::GetSelectedMasterPage (void)
-{
- const ::osl::MutexGuard aGuard (maMutex);
-
- SdPage* pMasterPage = NULL;
- sal_uInt16 nIndex = mpPageSet->GetSelectItemId();
- UserData* pData = GetUserData(nIndex);
- if (pData != NULL)
- {
- pMasterPage = mpContainer->GetPageObjectForToken(pData->second);
- }
- return pMasterPage;
-}
-
-
-
-
-/** Assemble a list of all slides of the document and pass it to
- AssignMasterPageToPageList().
-*/
-void MasterPagesSelector::AssignMasterPageToAllSlides (SdPage* pMasterPage)
-{
- if (pMasterPage == NULL)
- return;
-
- sal_uInt16 nPageCount = mrDocument.GetSdPageCount(PK_STANDARD);
- if (nPageCount == 0)
- return;
-
- // Get a list of all pages. As a little optimization we only
- // include pages that do not already have the given master page
- // assigned.
- OUString sFullLayoutName(pMasterPage->GetLayoutName());
- ::sd::slidesorter::SharedPageSelection pPageList (
- new ::sd::slidesorter::SlideSorterViewShell::PageSelection());
- for (sal_uInt16 nPageIndex=0; nPageIndex<nPageCount; nPageIndex++)
- {
- SdPage* pPage = mrDocument.GetSdPage (nPageIndex, PK_STANDARD);
- if (pPage != NULL && pPage->GetLayoutName() != sFullLayoutName)
- {
- pPageList->push_back (pPage);
- }
- }
-
- AssignMasterPageToPageList(pMasterPage, pPageList);
-}
-
-
-
-
-/** Assemble a list of the currently selected slides (selected in a visible
- slide sorter) and pass it to AssignMasterPageToPageList().
-*/
-void MasterPagesSelector::AssignMasterPageToSelectedSlides (
- SdPage* pMasterPage)
-{
- using namespace ::sd::slidesorter;
- using namespace ::sd::slidesorter::controller;
-
- if (pMasterPage == NULL)
- return;
-
- // Find a visible slide sorter.
- SlideSorterViewShell* pSlideSorter = SlideSorterViewShell::GetSlideSorter(mrBase);
- if (pSlideSorter == NULL)
- return;
-
- // Get a list of selected pages.
- SharedPageSelection pPageSelection = pSlideSorter->GetPageSelection();
- if (pPageSelection->empty())
- return;
-
- AssignMasterPageToPageList(pMasterPage, pPageSelection);
-
- // Restore the previous selection.
- pSlideSorter->SetPageSelection(pPageSelection);
-}
-
-
-
-
-void MasterPagesSelector::AssignMasterPageToPageList (
- SdPage* pMasterPage,
- const ::sd::slidesorter::SharedPageSelection& rPageList)
-{
- DocumentHelper::AssignMasterPageToPageList(mrDocument, pMasterPage, rPageList);
-}
-
-
-
-
-void MasterPagesSelector::NotifyContainerChangeEvent (const MasterPageContainerChangeEvent& rEvent)
-{
- const ::osl::MutexGuard aGuard (maMutex);
-
- switch (rEvent.meEventType)
- {
- case MasterPageContainerChangeEvent::SIZE_CHANGED:
- mpPageSet->SetPreviewSize(mpContainer->GetPreviewSizePixel());
- UpdateAllPreviews();
- break;
-
- case MasterPageContainerChangeEvent::PREVIEW_CHANGED:
- {
- int nIndex (GetIndexForToken(rEvent.maChildToken));
- if (nIndex >= 0)
- {
- mpPageSet->SetItemImage (
- (sal_uInt16)nIndex,
- mpContainer->GetPreviewForToken(rEvent.maChildToken));
- mpPageSet->Invalidate(mpPageSet->GetItemRect((sal_uInt16)nIndex));
- }
- }
- break;
-
- case MasterPageContainerChangeEvent::DATA_CHANGED:
- {
- InvalidateItem(rEvent.maChildToken);
- Fill();
- }
- break;
-
- case MasterPageContainerChangeEvent::CHILD_REMOVED:
- {
- int nIndex (GetIndexForToken(rEvent.maChildToken));
- SetItem(nIndex, MasterPageContainer::NIL_TOKEN);
- }
-
- default:
- break;
- }
-}
-
-
-
-
-MasterPagesSelector::UserData* MasterPagesSelector::CreateUserData (
- int nIndex,
- MasterPageContainer::Token aToken) const
-{
- return new UserData(nIndex,aToken);
-}
-
-
-
-
-MasterPagesSelector::UserData* MasterPagesSelector::GetUserData (int nIndex) const
-{
- const ::osl::MutexGuard aGuard (maMutex);
-
- if (nIndex>0 && static_cast<unsigned int>(nIndex)<=mpPageSet->GetItemCount())
- return reinterpret_cast<UserData*>(mpPageSet->GetItemData((sal_uInt16)nIndex));
- else
- return NULL;
-}
-
-
-
-
-void MasterPagesSelector::SetUserData (int nIndex, UserData* pData)
-{
- const ::osl::MutexGuard aGuard (maMutex);
-
- if (nIndex>0 && static_cast<unsigned int>(nIndex)<=mpPageSet->GetItemCount())
- {
- UserData* pOldData = GetUserData(nIndex);
- if (pOldData!=NULL && pOldData!=pData)
- delete pOldData;
- mpPageSet->SetItemData((sal_uInt16)nIndex, pData);
- }
-}
-
-
-
-
-bool MasterPagesSelector::IsResizable (void)
-{
- return false;
-}
-
-
-
-
-::Window* MasterPagesSelector::GetWindow (void)
-{
- return mpPageSet.get();
-}
-
-
-
-
-sal_Int32 MasterPagesSelector::GetMinimumWidth (void)
-{
- return mpContainer->GetPreviewSizePixel().Width() + 2*3;
-}
-
-
-
-
-void MasterPagesSelector::UpdateSelection (void)
-{
-}
-
-
-
-
-void MasterPagesSelector::Execute (SfxRequest& rRequest)
-{
- switch (rRequest.GetSlot())
- {
- case SID_TP_APPLY_TO_ALL_SLIDES:
- mrBase.SetBusyState (true);
- AssignMasterPageToAllSlides (GetSelectedMasterPage());
- mrBase.SetBusyState (false);
- break;
-
- case SID_TP_APPLY_TO_SELECTED_SLIDES:
- mrBase.SetBusyState (true);
- AssignMasterPageToSelectedSlides (GetSelectedMasterPage());
- mrBase.SetBusyState (false);
- break;
-
- case SID_TP_USE_FOR_NEW_PRESENTATIONS:
- DBG_ASSERT (false,
- "Using slides as default for new presentations"
- " is not yet implemented");
- break;
-
- case SID_TP_SHOW_SMALL_PREVIEW:
- case SID_TP_SHOW_LARGE_PREVIEW:
- {
- mrBase.SetBusyState (true);
- mpContainer->SetPreviewSize(
- rRequest.GetSlot()==SID_TP_SHOW_SMALL_PREVIEW
- ? MasterPageContainer::SMALL
- : MasterPageContainer::LARGE);
- mrBase.SetBusyState (false);
- break;
- }
-
- case SID_TP_EDIT_MASTER:
- {
- using namespace ::com::sun::star;
- uno::Reference<drawing::XDrawPage> xSelectedMaster;
- SdPage* pMasterPage = GetSelectedMasterPage();
- assert(pMasterPage); //rhbz#902884
- if (pMasterPage)
- xSelectedMaster = uno::Reference<drawing::XDrawPage>(pMasterPage->getUnoPage(), uno::UNO_QUERY);
- SfxViewFrame* pViewFrame = mrBase.GetViewFrame();
- if (pViewFrame != NULL && xSelectedMaster.is())
- {
- SfxDispatcher* pDispatcher = pViewFrame->GetDispatcher();
- if (pDispatcher != NULL)
- {
- sal_uInt16 nIndex = mpPageSet->GetSelectItemId();
- pDispatcher->Execute(SID_MASTERPAGE, SFX_CALLMODE_SYNCHRON);
- mpPageSet->SelectItem (nIndex);
- mrBase.GetDrawController().setCurrentPage(xSelectedMaster);
- }
- }
- break;
- }
-
- case SID_CUT:
- case SID_COPY:
- case SID_PASTE:
- // Cut, copy, and paste are not supported and thus are ignored.
- break;
- }
-}
-
-
-
-
-void MasterPagesSelector::GetState (SfxItemSet& rItemSet)
-{
- if (mpContainer->GetPreviewSize() == MasterPageContainer::SMALL)
- rItemSet.DisableItem (SID_TP_SHOW_SMALL_PREVIEW);
- else
- rItemSet.DisableItem (SID_TP_SHOW_LARGE_PREVIEW);
-
- // Cut and paste is not supported so do not show the menu entries.
- rItemSet.DisableItem (SID_CUT);
- rItemSet.DisableItem (SID_COPY);
- rItemSet.DisableItem (SID_PASTE);
-}
-
-
-
-
-void MasterPagesSelector::SetItem (
- sal_uInt16 nIndex,
- MasterPageContainer::Token aToken)
-{
- const ::osl::MutexGuard aGuard (maMutex);
-
- RemoveTokenToIndexEntry(nIndex,aToken);
-
- if (nIndex > 0)
- {
- if (aToken != MasterPageContainer::NIL_TOKEN)
- {
- Image aPreview (mpContainer->GetPreviewForToken(aToken));
- MasterPageContainer::PreviewState eState (mpContainer->GetPreviewState(aToken));
-
- if (aPreview.GetSizePixel().Width()>0)
- {
- if (mpPageSet->GetItemPos(nIndex) != VALUESET_ITEM_NOTFOUND)
- {
- mpPageSet->SetItemImage(nIndex,aPreview);
- mpPageSet->SetItemText(nIndex, mpContainer->GetPageNameForToken(aToken));
- }
- else
- {
- mpPageSet->InsertItem (
- nIndex,
- aPreview,
- mpContainer->GetPageNameForToken(aToken),
- nIndex);
- }
- SetUserData(nIndex, CreateUserData(nIndex,aToken));
-
- AddTokenToIndexEntry(nIndex,aToken);
- }
-
- if (eState == MasterPageContainer::PS_CREATABLE)
- mpContainer->RequestPreview(aToken);
- }
- else
- {
- mpPageSet->RemoveItem(nIndex);
- }
- }
-
-}
-
-
-
-
-void MasterPagesSelector::AddTokenToIndexEntry (
- sal_uInt16 nIndex,
- MasterPageContainer::Token aToken)
-{
- const ::osl::MutexGuard aGuard (maMutex);
-
- maTokenToValueSetIndex[aToken] = nIndex;
-}
-
-
-
-
-void MasterPagesSelector::RemoveTokenToIndexEntry (
- sal_uInt16 nIndex,
- MasterPageContainer::Token aNewToken)
-{
- const ::osl::MutexGuard aGuard (maMutex);
-
- UserData* pData = GetUserData(nIndex);
- if (pData != NULL)
- {
- // Get the token that the index pointed to previously.
- MasterPageContainer::Token aOldToken (pData->second);
-
- if (aNewToken != aOldToken
- && nIndex == GetIndexForToken(aOldToken))
- {
- maTokenToValueSetIndex[aOldToken] = 0;
- }
- }
-}
-
-
-
-
-void MasterPagesSelector::InvalidatePreview (const SdPage* pPage)
-{
- const ::osl::MutexGuard aGuard (maMutex);
-
- for (sal_uInt16 nIndex=1; nIndex<=mpPageSet->GetItemCount(); nIndex++)
- {
- UserData* pData = GetUserData(nIndex);
- if (pData != NULL)
- {
- MasterPageContainer::Token aToken (pData->second);
- if (pPage == mpContainer->GetPageObjectForToken(aToken,false))
- {
- mpContainer->InvalidatePreview(aToken);
- mpContainer->RequestPreview(aToken);
- break;
- }
- }
- }
-}
-
-void MasterPagesSelector::UpdateAllPreviews (void)
-{
- const ::osl::MutexGuard aGuard (maMutex);
-
- for (sal_uInt16 nIndex=1; nIndex<=mpPageSet->GetItemCount(); nIndex++)
- {
- UserData* pData = GetUserData(nIndex);
- if (pData != NULL)
- {
- MasterPageContainer::Token aToken (pData->second);
- mpPageSet->SetItemImage(
- nIndex,
- mpContainer->GetPreviewForToken(aToken));
- if (mpContainer->GetPreviewState(aToken) == MasterPageContainer::PS_CREATABLE)
- mpContainer->RequestPreview(aToken);
- }
- }
- mpPageSet->Rearrange(true);
-}
-
-
-
-
-void MasterPagesSelector::ClearPageSet (void)
-{
- const ::osl::MutexGuard aGuard (maMutex);
-
- for (sal_uInt16 nIndex=1; nIndex<=mpPageSet->GetItemCount(); nIndex++)
- {
- UserData* pData = GetUserData(nIndex);
- if (pData != NULL)
- delete pData;
- }
- mpPageSet->Clear();
-}
-
-
-
-
-void MasterPagesSelector::SetHelpId( const OString& aId )
-{
- const ::osl::MutexGuard aGuard (maMutex);
-
- mpPageSet->SetHelpId( aId );
-}
-
-
-
-
-sal_Int32 MasterPagesSelector::GetIndexForToken (MasterPageContainer::Token aToken) const
-{
- const ::osl::MutexGuard aGuard (maMutex);
-
- TokenToValueSetIndex::const_iterator iIndex (maTokenToValueSetIndex.find(aToken));
- if (iIndex != maTokenToValueSetIndex.end())
- return iIndex->second;
- else
- return -1;
-}
-
-
-
-
-void MasterPagesSelector::Clear (void)
-{
- const ::osl::MutexGuard aGuard (maMutex);
-
- ClearPageSet();
-}
-
-
-
-
-void MasterPagesSelector::InvalidateItem (MasterPageContainer::Token aToken)
-{
- const ::osl::MutexGuard aGuard (maMutex);
-
- ItemList::iterator iItem;
- for (iItem=maCurrentItemList.begin(); iItem!=maCurrentItemList.end(); ++iItem)
- {
- if (*iItem == aToken)
- {
- *iItem = MasterPageContainer::NIL_TOKEN;
- break;
- }
- }
-}
-
-
-
-SAL_WNODEPRECATED_DECLARATIONS_PUSH
-void MasterPagesSelector::UpdateItemList (::std::auto_ptr<ItemList> pNewItemList)
-{
- const ::osl::MutexGuard aGuard (maMutex);
-
- ItemList::const_iterator iNewItem (pNewItemList->begin());
- ItemList::const_iterator iCurrentItem (maCurrentItemList.begin());
- ItemList::const_iterator iNewEnd (pNewItemList->end());
- ItemList::const_iterator iCurrentEnd (maCurrentItemList.end());
- sal_uInt16 nIndex (1);
-
- // Update existing items.
- for ( ; iNewItem!=iNewEnd && iCurrentItem!=iCurrentEnd; ++iNewItem, ++iCurrentItem,++nIndex)
- {
- if (*iNewItem != *iCurrentItem)
- {
- SetItem(nIndex,*iNewItem);
- }
- }
-
- // Append new items.
- for ( ; iNewItem!=iNewEnd; ++iNewItem,++nIndex)
- {
- SetItem(nIndex,*iNewItem);
- }
-
- // Remove trailing items.
- for ( ; iCurrentItem!=iCurrentEnd; ++iCurrentItem,++nIndex)
- {
- SetItem(nIndex,MasterPageContainer::NIL_TOKEN);
- }
-
- maCurrentItemList.swap(*pNewItemList);
-
- mpPageSet->Rearrange();
- if (GetParentNode() != NULL)
- GetParentNode()->RequestResize();
-}
-SAL_WNODEPRECATED_DECLARATIONS_POP
-
-
-
-
-} } } // end of namespace ::sd::toolpanel::controls
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/toolpanel/controls/MasterPagesSelector.hxx b/sd/source/ui/toolpanel/controls/MasterPagesSelector.hxx
deleted file mode 100644
index ed1f83a768fb..000000000000
--- a/sd/source/ui/toolpanel/controls/MasterPagesSelector.hxx
+++ /dev/null
@@ -1,226 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#ifndef SD_TASKPANE_CONTROLS_MASTER_PAGES_SELECTOR_HXX
-#define SD_TASKPANE_CONTROLS_MASTER_PAGES_SELECTOR_HXX
-
-#include "taskpane/TaskPaneTreeNode.hxx"
-#include "MasterPageContainer.hxx"
-#include "SlideSorterViewShell.hxx"
-
-#include "pres.hxx"
-#include <sfx2/shell.hxx>
-#include <vcl/image.hxx>
-#include "glob.hxx"
-#include <osl/mutex.hxx>
-
-#include <queue>
-
-class MouseEvent;
-class SdDrawDocument;
-class SdPage;
-
-namespace sd {
-class ViewShellBase;
-}
-
-namespace sd { namespace toolpanel { namespace controls {
-
-class PreviewValueSet;
-
-/** Base class of a menu that lets the user select from a list of
- templates or designs that are loaded from files.
-*/
-class MasterPagesSelector
- : public TreeNode,
- public SfxShell
-{
-public:
- TYPEINFO();
- SFX_DECL_INTERFACE(SD_IF_SDMASTERPAGESSELECTOR)
-
- MasterPagesSelector (
- TreeNode* pParent,
- SdDrawDocument& rDocument,
- ViewShellBase& rBase,
- const ::boost::shared_ptr<MasterPageContainer>& rpContainer);
- virtual ~MasterPagesSelector (void);
-
- virtual void LateInit (void);
-
- /** Return the height that this control needs to show all of its lines.
- */
- long GetRequiredHeight (int nWidth) const;
-
- /** The given master page, either the master page of a slide or a notes
- page, is cloned and inserted into mrDocument. The necessary styles
- are copied as well.
- */
- static SdPage* AddMasterPage (
- SdDrawDocument* pTargetDocument,
- SdPage* pMasterPage,
- sal_uInt16 nInsertionIndex);
-
- virtual Size GetPreferredSize (void);
- virtual sal_Int32 GetPreferredWidth (sal_Int32 nHeight);
- virtual sal_Int32 GetPreferredHeight (sal_Int32 nWidth);
- virtual bool IsResizable (void);
- virtual ::Window* GetWindow (void);
- virtual sal_Int32 GetMinimumWidth (void);
-
- virtual void Execute (SfxRequest& rRequest);
- virtual void GetState (SfxItemSet& rItemSet);
-
- /** Update the selection of previews according to whatever
- influences them appart from mouse and keyboard. If, for
- example, the current page of the main pane changes, then call
- this method at the CurrentMasterPagesSelector to select the
- previews of the master pages that are assigned to the new
- current page.
-
- The default implementation of this method ignores the call. This is
- used by e.g. the RecentMasterPagesSelector because it does not show
- the currently used master pages by default and thus is not
- influenced by its changes.
- */
- virtual void UpdateSelection (void);
-
- void FillPageSet (void);
-
- /** Make the selector empty. This method clear the value set from any
- entries. Overload this method to add functionality, especially to
- destroy objects set as data items at the value set.
- */
- void ClearPageSet (void);
-
- using SfxShell::SetHelpId;
- void SetHelpId( const OString& aId );
-
- /** Mark the preview that belongs to the given index as not up-to-date
- anymore with respect to page content or preview size.
- The implementation of this method will either sunchronously or
- asynchronously call UpdatePreview().
- @param nIndex
- Index into the value set control that is used for displaying the
- previews.
- */
- void InvalidatePreview (const SdPage* pPage);
-
- void UpdateAllPreviews (void);
-
-protected:
- mutable ::osl::Mutex maMutex;
- ::boost::shared_ptr<MasterPageContainer> mpContainer;
-
- SdDrawDocument& mrDocument;
- ::std::auto_ptr<PreviewValueSet> mpPageSet;
- bool mbSmallPreviewSize;
- ViewShellBase& mrBase;
- /** Slot that is executed as default action when the left mouse button is
- clicked over a master page.
- */
- sal_uInt16 mnDefaultClickAction;
- /** Pages with pointers in this queue have their previews updated
- eventually. Filled by InvalidatePreview() and operated upon by
- UpdatePreviews().
- */
- ::std::queue<sal_uInt16> maPreviewUpdateQueue;
-
- virtual SdPage* GetSelectedMasterPage (void);
-
- /** Assign the given master page to all slides of the document.
- @param pMasterPage
- The master page to assign to all slides.
- */
- void AssignMasterPageToAllSlides (SdPage* pMasterPage);
-
- /** Assign the given master page to all slides that are selected in a
- slide sorter that is displayed in the lef or center pane. When both
- panes display a slide sorter then the one in the center pane is
- used.
- */
- void AssignMasterPageToSelectedSlides (SdPage* pMasterPage);
-
- virtual void AssignMasterPageToPageList (
- SdPage* pMasterPage,
- const ::sd::slidesorter::SharedPageSelection& rPageList);
-
- virtual void NotifyContainerChangeEvent (const MasterPageContainerChangeEvent& rEvent);
-
- typedef ::std::pair<int, MasterPageContainer::Token> UserData;
- UserData* CreateUserData (int nIndex, MasterPageContainer::Token aToken) const;
- UserData* GetUserData (int nIndex) const;
- void SetUserData (int nIndex, UserData* pData);
-
- virtual sal_Int32 GetIndexForToken (MasterPageContainer::Token aToken) const;
- typedef ::std::vector<MasterPageContainer::Token> ItemList;
- void UpdateItemList (::std::auto_ptr<ItemList> pList);
- void Clear (void);
- /** Invalidate the specified item so that on the next Fill() this item
- is updated.
- */
- void InvalidateItem (MasterPageContainer::Token aToken);
-
- // For every item in the ValueSet we store its associated token. This
- // allows a faster access and easier change tracking.
- ItemList maCurrentItemList;
- typedef ::std::map<MasterPageContainer::Token,sal_Int32> TokenToValueSetIndex;
- TokenToValueSetIndex maTokenToValueSetIndex;
-
- ItemList maLockedMasterPages;
- /** Lock master pages in the given list and release locks that where
- previously aquired.
- */
- void UpdateLocks (const ItemList& rItemList);
-
- void Fill (void);
- virtual void Fill (ItemList& rItemList) = 0;
-
- /** Give derived classes the oportunity to provide their own context
- menu. If they do then they probably have to provide their own
- Execute() and GetState() methods as well.
- */
- virtual ResId GetContextMenuResId (void) const;
-
-private:
- /** The offset between ValueSet index and MasterPageContainer::Token
- last seen. This value is used heuristically to speed up the lookup
- of an index for a token.
- */
- DECL_LINK(ClickHandler, void *);
- DECL_LINK(RightClickHandler, MouseEvent*);
- DECL_LINK(ContextMenuCallback, CommandEvent*);
- DECL_LINK(ContainerChangeListener, MasterPageContainerChangeEvent*);
-
- void SetItem (
- sal_uInt16 nIndex,
- MasterPageContainer::Token aToken);
- void AddTokenToIndexEntry (
- sal_uInt16 nIndex,
- MasterPageContainer::Token aToken);
- void RemoveTokenToIndexEntry (
- sal_uInt16 nIndex,
- MasterPageContainer::Token aToken);
-};
-
-} } } // end of namespace ::sd::toolpanel::controls
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/toolpanel/controls/PreviewValueSet.cxx b/sd/source/ui/toolpanel/controls/PreviewValueSet.cxx
deleted file mode 100644
index 3328d07b0a0e..000000000000
--- a/sd/source/ui/toolpanel/controls/PreviewValueSet.cxx
+++ /dev/null
@@ -1,232 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-
-#include "PreviewValueSet.hxx"
-#include <vcl/image.hxx>
-#include "taskpane/TaskPaneTreeNode.hxx"
-
-namespace sd { namespace toolpanel { namespace controls {
-
-
-PreviewValueSet::PreviewValueSet (TreeNode* pParent)
- : ValueSet (pParent->GetWindow(), WB_TABSTOP),
- mpParent(pParent),
- maPreviewSize(10,10),
- mnBorderWidth(3),
- mnBorderHeight(3),
- mnMaxColumnCount(-1)
-{
- SetStyle (
- GetStyle()
- & ~(WB_ITEMBORDER)// | WB_MENUSTYLEVALUESET)
- // | WB_FLATVALUESET);
- );
-
- SetColCount(2);
- // SetLineCount(1);
- SetExtraSpacing (2);
-}
-
-
-
-
-PreviewValueSet::~PreviewValueSet (void)
-{
-}
-
-
-
-
-void PreviewValueSet::SetPreviewSize (const Size& rSize)
-{
- maPreviewSize = rSize;
-}
-
-
-
-
-void PreviewValueSet::SetRightMouseClickHandler (const Link& rLink)
-{
- maRightMouseClickHandler = rLink;
-}
-
-
-
-
-void PreviewValueSet::MouseButtonDown (const MouseEvent& rEvent)
-{
- if (rEvent.IsRight())
- maRightMouseClickHandler.Call(reinterpret_cast<void*>(
- &const_cast<MouseEvent&>(rEvent)));
- else
- ValueSet::MouseButtonDown (rEvent);
-
-}
-
-
-
-
-void PreviewValueSet::Paint (const Rectangle& rRect)
-{
- SetBackground (GetSettings().GetStyleSettings().GetWindowColor());
-
- ValueSet::Paint (rRect);
-
- SetBackground (Wallpaper());
-}
-
-
-
-
-void PreviewValueSet::Resize (void)
-{
- ValueSet::Resize ();
-
- Size aWindowSize (GetOutputSizePixel());
- if (aWindowSize.Width()>0 && aWindowSize.Height()>0)
- {
- Rearrange();
- }
-}
-
-
-
-
-void PreviewValueSet::Command (const CommandEvent& rEvent)
-{
- switch (rEvent.GetCommand())
- {
- case COMMAND_CONTEXTMENU:
- {
- CommandEvent aNonConstEventCopy (rEvent);
- maContextMenuCallback.Call(&aNonConstEventCopy);
- }
- break;
-
- default:
- ValueSet::Command(rEvent);
- break;
- }
-}
-
-
-
-
-void PreviewValueSet::Rearrange (bool bForceRequestResize)
-{
- sal_uInt16 nOldColumnCount (GetColCount());
- sal_uInt16 nOldRowCount (GetLineCount());
-
- sal_uInt16 nNewColumnCount (CalculateColumnCount (
- GetOutputSizePixel().Width()));
- sal_uInt16 nNewRowCount (CalculateRowCount (nNewColumnCount));
-
- SetColCount(nNewColumnCount);
- SetLineCount(nNewRowCount);
-
- if (bForceRequestResize
- || nOldColumnCount != nNewColumnCount
- || nOldRowCount != nNewRowCount)
- mpParent->RequestResize();
-}
-
-
-
-
-void PreviewValueSet::SetContextMenuCallback (const Link& rLink)
-{
- maContextMenuCallback = rLink;
-}
-
-
-
-
-sal_uInt16 PreviewValueSet::CalculateColumnCount (int nWidth) const
-{
- int nColumnCount = 0;
- if (nWidth > 0)
- {
- nColumnCount = nWidth / (maPreviewSize.Width() + 2*mnBorderWidth);
- if (nColumnCount < 1)
- nColumnCount = 1;
- else if (mnMaxColumnCount>0 && nColumnCount>mnMaxColumnCount)
- nColumnCount = mnMaxColumnCount;
- }
- return (sal_uInt16)nColumnCount;
-}
-
-
-
-
-sal_uInt16 PreviewValueSet::CalculateRowCount (sal_uInt16 nColumnCount) const
-{
- int nRowCount = 0;
- int nItemCount = GetItemCount();
- if (nColumnCount > 0)
- {
- nRowCount = (nItemCount+nColumnCount-1) / nColumnCount;
- if (nRowCount < 1)
- nRowCount = 1;
- }
-
- return (sal_uInt16)nRowCount;
-}
-
-
-
-
-sal_Int32 PreviewValueSet::GetPreferredWidth (sal_Int32 nHeight)
-{
- int nPreferredWidth (maPreviewSize.Width() + 2*mnBorderWidth);
-
- // Get height of each row.
- int nItemHeight (maPreviewSize.Height() + 2*mnBorderHeight);
-
- // Calculate the row- and column count and from the later the preferred
- // width.
- int nRowCount = nHeight / nItemHeight;
- if (nRowCount > 0)
- {
- int nColumnCount = (GetItemCount()+nRowCount-1) / nRowCount;
- if (nColumnCount > 0)
- nPreferredWidth = (maPreviewSize.Width() + 2*mnBorderWidth)
- * nColumnCount;
- }
-
- return nPreferredWidth;
-}
-
-
-
-
-sal_Int32 PreviewValueSet::GetPreferredHeight (sal_Int32 nWidth)
-{
- int nRowCount (CalculateRowCount(CalculateColumnCount(nWidth)));
- int nItemHeight (maPreviewSize.Height());
-
- return nRowCount * (nItemHeight + 2*mnBorderHeight);
-}
-
-
-
-
-} } } // end of namespace ::sd::toolpanel::controls
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/toolpanel/controls/PreviewValueSet.hxx b/sd/source/ui/toolpanel/controls/PreviewValueSet.hxx
deleted file mode 100644
index ad928e813ae6..000000000000
--- a/sd/source/ui/toolpanel/controls/PreviewValueSet.hxx
+++ /dev/null
@@ -1,90 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#ifndef SD_TOOLPANEL_PREVIEW_VALUE_SET_HXX
-#define SD_TOOLPANEL_PREVIEW_VALUE_SET_HXX
-
-#include <svtools/valueset.hxx>
-
-
-namespace sd { namespace toolpanel {
-class TreeNode;
-} }
-
-namespace sd { namespace toolpanel { namespace controls {
-
-
-/** Adapt the svtools valueset to the needs of the master page controlls.
-*/
-class PreviewValueSet
- : public ValueSet
-{
-public:
- PreviewValueSet (TreeNode* pParent);
- ~PreviewValueSet (void);
-
- void SetRightMouseClickHandler (const Link& rLink);
- virtual void Paint (const Rectangle& rRect);
- virtual void Resize (void);
-
- /** When a request for the display of a context menu is made to this
- method then that request is forwarded via the ContextMenuCallback.
- This way the owning class can handle the context menu without having
- to be derived from this class.
- Use SetContextMenuCallback to set or rest the handler.
- */
- virtual void Command (const CommandEvent& rEvent);
-
- void SetPreviewSize (const Size& rSize);
-
- sal_Int32 GetPreferredWidth (sal_Int32 nHeight);
- sal_Int32 GetPreferredHeight (sal_Int32 nWidth);
-
- /** Set the number of rows and columns according to the current number
- of items. Call this method when new items have been inserted.
- */
- void Rearrange (bool bForceRequestResize = false);
-
- /** Set the callback function to which requests for context menus are
- forewarded. Call with an empty Link to reset the callback
- function.
- */
- void SetContextMenuCallback (const Link& rLink);
-
-protected:
- virtual void MouseButtonDown (const MouseEvent& rEvent);
-
-private:
- Link maRightMouseClickHandler;
- Link maContextMenuCallback;
- TreeNode* mpParent;
- Size maPreviewSize;
- const int mnBorderWidth;
- const int mnBorderHeight;
- const int mnMaxColumnCount;
-
- sal_uInt16 CalculateColumnCount (int nWidth) const;
- sal_uInt16 CalculateRowCount (sal_uInt16 nColumnCount) const;
-};
-
-} } } // end of namespace ::sd::toolpanel::controls
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/toolpanel/controls/RecentMasterPagesSelector.cxx b/sd/source/ui/toolpanel/controls/RecentMasterPagesSelector.cxx
deleted file mode 100644
index dc483a5d7a97..000000000000
--- a/sd/source/ui/toolpanel/controls/RecentMasterPagesSelector.cxx
+++ /dev/null
@@ -1,149 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-
-#include "RecentMasterPagesSelector.hxx"
-#include "PreviewValueSet.hxx"
-
-#include "RecentlyUsedMasterPages.hxx"
-#include "MasterPageContainerProviders.hxx"
-#include "MasterPageObserver.hxx"
-#include "sdpage.hxx"
-#include "drawdoc.hxx"
-#include "app.hrc"
-#include <vcl/bitmap.hxx>
-
-namespace sd { namespace toolpanel { namespace controls {
-
-
-RecentMasterPagesSelector::RecentMasterPagesSelector (
- TreeNode* pParent,
- SdDrawDocument& rDocument,
- ViewShellBase& rBase,
- const ::boost::shared_ptr<MasterPageContainer>& rpContainer)
- : MasterPagesSelector (pParent, rDocument, rBase, rpContainer)
-{
- SetName (OUString("RecentMasterPagesSelector"));
-}
-
-
-
-
-RecentMasterPagesSelector::~RecentMasterPagesSelector (void)
-{
- RecentlyUsedMasterPages::Instance().RemoveEventListener (
- LINK(this,RecentMasterPagesSelector,MasterPageListListener));
-}
-
-
-
-
-void RecentMasterPagesSelector::LateInit (void)
-{
- MasterPagesSelector::LateInit();
-
- MasterPagesSelector::Fill();
- RecentlyUsedMasterPages::Instance().AddEventListener (
- LINK(this,RecentMasterPagesSelector,MasterPageListListener));
-}
-
-
-
-
-IMPL_LINK_NOARG(RecentMasterPagesSelector, MasterPageListListener)
-{
- MasterPagesSelector::Fill();
- return 0;
-}
-
-
-
-
-void RecentMasterPagesSelector::Fill (ItemList& rItemList)
-{
- // Create a set of names of the master pages used by the document.
- MasterPageObserver::MasterPageNameSet aCurrentNames;
- sal_uInt16 nMasterPageCount = mrDocument.GetMasterSdPageCount(PK_STANDARD);
- sal_uInt16 nIndex;
- for (nIndex=0; nIndex<nMasterPageCount; nIndex++)
- {
- SdPage* pMasterPage = mrDocument.GetMasterSdPage (nIndex, PK_STANDARD);
- if (pMasterPage != NULL)
- aCurrentNames.insert (pMasterPage->GetName());
- }
-
- // Insert the recently used master pages that are currently not used.
- RecentlyUsedMasterPages& rInstance (RecentlyUsedMasterPages::Instance());
- int nPageCount = rInstance.GetMasterPageCount();
- for (nIndex=0; nIndex<nPageCount; nIndex++)
- {
- // Add an entry when a) the page is already known to the
- // MasterPageContainer, b) the style name is empty, i.e. it has not yet
- // been loaded (and thus can not be in use) or otherwise c) the
- // style name is not currently in use.
- MasterPageContainer::Token aToken (rInstance.GetTokenForIndex(nIndex));
- if (aToken != MasterPageContainer::NIL_TOKEN)
- {
- OUString sStyleName (mpContainer->GetStyleNameForToken(aToken));
- if (sStyleName.isEmpty()
- || aCurrentNames.find(sStyleName) == aCurrentNames.end())
- {
- rItemList.push_back(aToken);
- }
- }
- }
-}
-
-
-
-
-void RecentMasterPagesSelector::AssignMasterPageToPageList (
- SdPage* pMasterPage,
- const ::boost::shared_ptr<std::vector<SdPage*> >& rpPageList)
-{
- sal_uInt16 nSelectedItemId = mpPageSet->GetSelectItemId();
-
- MasterPagesSelector::AssignMasterPageToPageList(pMasterPage, rpPageList);
-
- // Restore the selection.
- if (mpPageSet->GetItemCount() > 0)
- {
- if (mpPageSet->GetItemCount() >= nSelectedItemId)
- mpPageSet->SelectItem(nSelectedItemId);
- else
- mpPageSet->SelectItem(mpPageSet->GetItemCount());
- }
-}
-
-
-
-
-void RecentMasterPagesSelector::GetState (SfxItemSet& rItemSet)
-{
- MasterPagesSelector::GetState (rItemSet);
- if (rItemSet.GetItemState(SID_TP_EDIT_MASTER) == SFX_ITEM_AVAILABLE)
- rItemSet.DisableItem (SID_TP_EDIT_MASTER);
-}
-
-
-
-
-} } } // end of namespace ::sd::toolpanel::controls
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/toolpanel/controls/RecentMasterPagesSelector.hxx b/sd/source/ui/toolpanel/controls/RecentMasterPagesSelector.hxx
deleted file mode 100644
index 04bb17a97a95..000000000000
--- a/sd/source/ui/toolpanel/controls/RecentMasterPagesSelector.hxx
+++ /dev/null
@@ -1,70 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#ifndef SD_TOOLPANEL_CONTROLS_RECENT_MASTER_PAGES_SELECTOR_HXX
-#define SD_TOOLPANEL_CONTROLS_RECENT_MASTER_PAGES_SELECTOR_HXX
-
-#include "MasterPagesSelector.hxx"
-
-namespace sd { namespace toolpanel { namespace controls {
-
-
-/** Show the recently used master pages (that are not currently used).
-*/
-class RecentMasterPagesSelector
- : public MasterPagesSelector
-{
-public:
- RecentMasterPagesSelector (
- TreeNode* pParent,
- SdDrawDocument& rDocument,
- ViewShellBase& rBase,
- const ::boost::shared_ptr<MasterPageContainer>& rpContainer);
- virtual ~RecentMasterPagesSelector (void);
-
- virtual void LateInit (void);
-
- virtual void GetState (SfxItemSet& rItemSet);
-
-protected:
- DECL_LINK(MasterPageListListener, void*);
- virtual void Fill (ItemList& rItemList);
-
- using sd::toolpanel::controls::MasterPagesSelector::Fill;
-
- /** Forward this call to the base class but save and restore the
- currently selected item.
- Assign the given master page to the list of pages.
- @param pMasterPage
- This master page will usually be a member of the list of all
- available master pages as provided by the MasterPageContainer.
- @param rPageList
- The pages to which to assign the master page. These pages may
- be slides or master pages themselves.
- */
- virtual void AssignMasterPageToPageList (
- SdPage* pMasterPage,
- const ::boost::shared_ptr<std::vector<SdPage*> >& rpPageList);
-};
-
-} } } // end of namespace ::sd::toolpanel::controls
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/toolpanel/controls/RecentlyUsedMasterPages.cxx b/sd/source/ui/toolpanel/controls/RecentlyUsedMasterPages.cxx
deleted file mode 100644
index 7969bbd7fc70..000000000000
--- a/sd/source/ui/toolpanel/controls/RecentlyUsedMasterPages.cxx
+++ /dev/null
@@ -1,482 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-
-#include "RecentlyUsedMasterPages.hxx"
-#include "MasterPageObserver.hxx"
-#include "MasterPagesSelector.hxx"
-#include "MasterPageDescriptor.hxx"
-#include "tools/ConfigurationAccess.hxx"
-#include "drawdoc.hxx"
-#include "sdpage.hxx"
-
-#include <algorithm>
-#include <vector>
-
-#include <comphelper/processfactory.hxx>
-#include "unomodel.hxx"
-#include <com/sun/star/drawing/XDrawPagesSupplier.hpp>
-#include <com/sun/star/drawing/XDrawPages.hpp>
-#include <com/sun/star/frame/XComponentLoader.hpp>
-#include <com/sun/star/container/XNameAccess.hpp>
-#include <com/sun/star/container/XHierarchicalNameAccess.hpp>
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-#include <com/sun/star/beans/PropertyValue.hpp>
-#include <com/sun/star/beans/PropertyState.hpp>
-#include <unotools/confignode.hxx>
-#include <osl/doublecheckedlocking.h>
-#include <osl/getglobalmutex.hxx>
-
-using namespace ::std;
-using namespace ::com::sun::star;
-using namespace ::com::sun::star::uno;
-
-
-namespace {
-
-static const OUString& GetPathToImpressConfigurationRoot (void)
-{
- static const OUString sPathToImpressConfigurationRoot ("/org.openoffice.Office.Impress/");
- return sPathToImpressConfigurationRoot;
-}
-static const OUString& GetPathToSetNode (void)
-{
- static const OUString sPathToSetNode("MultiPaneGUI/ToolPanel/RecentlyUsedMasterPages");
- return sPathToSetNode;
-}
-
-
-class Descriptor
-{
-public:
- OUString msURL;
- OUString msName;
- ::sd::toolpanel::controls::MasterPageContainer::Token maToken;
- Descriptor (const OUString& rsURL, const OUString& rsName)
- : msURL(rsURL),
- msName(rsName),
- maToken(::sd::toolpanel::controls::MasterPageContainer::NIL_TOKEN)
- {}
- Descriptor (::sd::toolpanel::controls::MasterPageContainer::Token aToken,
- const OUString& rsURL, const OUString& rsName)
- : msURL(rsURL),
- msName(rsName),
- maToken(aToken)
- {}
- class TokenComparator
- {
- public:
- TokenComparator(::sd::toolpanel::controls::MasterPageContainer::Token aToken)
- : maToken(aToken) {}
- bool operator () (const Descriptor& rDescriptor) const
- { return maToken==rDescriptor.maToken; }
- private:
- ::sd::toolpanel::controls::MasterPageContainer::Token maToken;
- };
-};
-
-} // end of anonymous namespace
-
-
-
-
-namespace sd { namespace toolpanel { namespace controls {
-
-class RecentlyUsedMasterPages::MasterPageList : public ::std::vector<Descriptor>
-{
-public:
- MasterPageList (void) {}
-};
-
-
-RecentlyUsedMasterPages* RecentlyUsedMasterPages::mpInstance = NULL;
-
-
-RecentlyUsedMasterPages& RecentlyUsedMasterPages::Instance (void)
-{
- if (mpInstance == NULL)
- {
- ::osl::GetGlobalMutex aMutexFunctor;
- ::osl::MutexGuard aGuard (aMutexFunctor());
- if (mpInstance == NULL)
- {
- RecentlyUsedMasterPages* pInstance = new RecentlyUsedMasterPages();
- pInstance->LateInit();
- SdGlobalResourceContainer::Instance().AddResource (
- ::std::auto_ptr<SdGlobalResource>(pInstance));
- OSL_DOUBLE_CHECKED_LOCKING_MEMORY_BARRIER();
- mpInstance = pInstance;
- }
- }
- else {
- OSL_DOUBLE_CHECKED_LOCKING_MEMORY_BARRIER();
- }
-
- return *mpInstance;
-}
-
-
-
-
-RecentlyUsedMasterPages::RecentlyUsedMasterPages (void)
- : maListeners(),
- mpMasterPages(new MasterPageList()),
- mnMaxListSize(8),
- mpContainer(new MasterPageContainer())
-{
-}
-
-
-
-
-RecentlyUsedMasterPages::~RecentlyUsedMasterPages (void)
-{
- Link aLink (LINK(this,RecentlyUsedMasterPages,MasterPageContainerChangeListener));
- mpContainer->RemoveChangeListener(aLink);
-
- MasterPageObserver::Instance().RemoveEventListener(
- LINK(this,RecentlyUsedMasterPages,MasterPageChangeListener));
-}
-
-
-
-
-void RecentlyUsedMasterPages::LateInit (void)
-{
- Link aLink (LINK(this,RecentlyUsedMasterPages,MasterPageContainerChangeListener));
- mpContainer->AddChangeListener(aLink);
-
- LoadPersistentValues ();
- MasterPageObserver::Instance().AddEventListener(
- LINK(this,RecentlyUsedMasterPages,MasterPageChangeListener));
-}
-
-
-
-
-void RecentlyUsedMasterPages::LoadPersistentValues (void)
-{
- try
- {
- tools::ConfigurationAccess aConfiguration (
- GetPathToImpressConfigurationRoot(),
- tools::ConfigurationAccess::READ_ONLY);
- Reference<container::XNameAccess> xSet (
- aConfiguration.GetConfigurationNode(GetPathToSetNode()),
- UNO_QUERY);
- if ( ! xSet.is())
- return;
-
- const OUString sURLMemberName("URL");
- const OUString sNameMemberName("Name");
- OUString sURL;
- OUString sName;
-
- // Read the names and URLs of the master pages.
- Sequence<OUString> aKeys (xSet->getElementNames());
- mpMasterPages->clear();
- mpMasterPages->reserve(aKeys.getLength());
- for (int i=0; i<aKeys.getLength(); i++)
- {
- Reference<container::XNameAccess> xSetItem (
- xSet->getByName(aKeys[i]), UNO_QUERY);
- if (xSetItem.is())
- {
- Any aURL (xSetItem->getByName(sURLMemberName));
- Any aName (xSetItem->getByName(sNameMemberName));
- aURL >>= sURL;
- aName >>= sName;
- SharedMasterPageDescriptor pDescriptor (new MasterPageDescriptor(
- MasterPageContainer::TEMPLATE,
- -1,
- sURL,
- OUString(),
- sName,
- false,
- ::boost::shared_ptr<PageObjectProvider>(
- new TemplatePageObjectProvider(sURL)),
- ::boost::shared_ptr<PreviewProvider>(
- new TemplatePreviewProvider(sURL))));
- // For user supplied templates we use a different
- // preview provider: The preview in the document shows
- // not only shapes on the master page but also shapes on
- // the foreground. This is misleading and therefore
- // these previews are discarded and created directly
- // from the page objects.
- if (pDescriptor->GetURLClassification() == MasterPageDescriptor::URLCLASS_USER)
- pDescriptor->mpPreviewProvider = ::boost::shared_ptr<PreviewProvider>(
- new PagePreviewProvider());
- MasterPageContainer::Token aToken (mpContainer->PutMasterPage(pDescriptor));
- mpMasterPages->push_back(Descriptor(aToken,sURL,sName));
- }
- }
-
- ResolveList();
- }
- catch (Exception&)
- {
- // Ignore exception.
- }
-}
-
-
-
-
-void RecentlyUsedMasterPages::SavePersistentValues (void)
-{
- try
- {
- tools::ConfigurationAccess aConfiguration (
- GetPathToImpressConfigurationRoot(),
- tools::ConfigurationAccess::READ_WRITE);
- Reference<container::XNameContainer> xSet (
- aConfiguration.GetConfigurationNode(GetPathToSetNode()),
- UNO_QUERY);
- if ( ! xSet.is())
- return;
-
- // Clear the set.
- Sequence<OUString> aKeys (xSet->getElementNames());
- sal_Int32 i;
- for (i=0; i<aKeys.getLength(); i++)
- xSet->removeByName (aKeys[i]);
-
- // Fill it with the URLs of this object.
- const OUString sURLMemberName("URL");
- const OUString sNameMemberName("Name");
- Any aValue;
- Reference<lang::XSingleServiceFactory> xChildFactory (
- xSet, UNO_QUERY);
- if ( ! xChildFactory.is())
- return;
- MasterPageList::const_iterator iDescriptor;
- sal_Int32 nIndex(0);
- for (iDescriptor=mpMasterPages->begin();
- iDescriptor!=mpMasterPages->end();
- ++iDescriptor,++nIndex)
- {
- // Create new child.
- OUString sKey ("index_");
- sKey += OUString::number(nIndex);
- Reference<container::XNameReplace> xChild(
- xChildFactory->createInstance(), UNO_QUERY);
- if (xChild.is())
- {
- xSet->insertByName (sKey, makeAny(xChild));
-
- aValue <<= OUString(iDescriptor->msURL);
- xChild->replaceByName (sURLMemberName, aValue);
-
- aValue <<= OUString(iDescriptor->msName);
- xChild->replaceByName (sNameMemberName, aValue);
- }
- }
-
- // Write the data back to disk.
- aConfiguration.CommitChanges();
- }
- catch (Exception&)
- {
- // Ignore exception.
- }
-}
-
-
-
-
-void RecentlyUsedMasterPages::AddEventListener (const Link& rEventListener)
-{
- if (::std::find (
- maListeners.begin(),
- maListeners.end(),
- rEventListener) == maListeners.end())
- {
- maListeners.push_back (rEventListener);
- }
-}
-
-
-
-
-void RecentlyUsedMasterPages::RemoveEventListener (const Link& rEventListener)
-{
- maListeners.erase (
- ::std::find (
- maListeners.begin(),
- maListeners.end(),
- rEventListener));
-}
-
-
-
-
-int RecentlyUsedMasterPages::GetMasterPageCount (void) const
-{
- return mpMasterPages->size();
-}
-
-
-
-
-MasterPageContainer::Token RecentlyUsedMasterPages::GetTokenForIndex (sal_uInt32 nIndex) const
-{
- if(nIndex<mpMasterPages->size())
- return (*mpMasterPages)[nIndex].maToken;
- else
- return MasterPageContainer::NIL_TOKEN;
-}
-
-
-
-
-void RecentlyUsedMasterPages::SendEvent (void)
-{
- ::std::vector<Link>::iterator aLink (maListeners.begin());
- ::std::vector<Link>::iterator aEnd (maListeners.end());
- while (aLink!=aEnd)
- {
- aLink->Call (NULL);
- ++aLink;
- }
-}
-
-
-
-
-IMPL_LINK(RecentlyUsedMasterPages, MasterPageChangeListener,
- MasterPageObserverEvent*, pEvent)
-{
- switch (pEvent->meType)
- {
- case MasterPageObserverEvent::ET_MASTER_PAGE_ADDED:
- case MasterPageObserverEvent::ET_MASTER_PAGE_EXISTS:
- AddMasterPage(
- mpContainer->GetTokenForStyleName(pEvent->mrMasterPageName));
- break;
-
- case MasterPageObserverEvent::ET_MASTER_PAGE_REMOVED:
- // Do not change the list of recently master pages (the deleted
- // page was recently used) but tell the listeners. They may want
- // to update their lists.
- SendEvent();
- break;
- }
- return 0;
-}
-
-
-
-
-IMPL_LINK(RecentlyUsedMasterPages, MasterPageContainerChangeListener,
- MasterPageContainerChangeEvent*, pEvent)
-{
- if (pEvent != NULL)
- switch (pEvent->meEventType)
- {
- case MasterPageContainerChangeEvent::CHILD_ADDED:
- case MasterPageContainerChangeEvent::CHILD_REMOVED:
- case MasterPageContainerChangeEvent::INDEX_CHANGED:
- case MasterPageContainerChangeEvent::INDEXES_CHANGED:
- ResolveList();
- break;
-
- default:
- // Ignored.
- break;
- }
- return 0;
-}
-
-
-
-
-void RecentlyUsedMasterPages::AddMasterPage (
- MasterPageContainer::Token aToken,
- bool bMakePersistent)
-{
- // For the page to be inserted the token has to be valid and the page
- // has to have a valid URL. This excludes master pages that do not come
- // from template files.
- if (aToken != MasterPageContainer::NIL_TOKEN
- && !mpContainer->GetURLForToken(aToken).isEmpty())
- {
-
- MasterPageList::iterator aIterator (
- ::std::find_if(mpMasterPages->begin(),mpMasterPages->end(),
- Descriptor::TokenComparator(aToken)));
- if (aIterator != mpMasterPages->end())
- {
- // When an entry for the given token already exists then remove
- // it now and insert it later at the head of the list.
- mpMasterPages->erase (aIterator);
- }
-
- mpMasterPages->insert(mpMasterPages->begin(),
- Descriptor(
- aToken,
- mpContainer->GetURLForToken(aToken),
- mpContainer->GetStyleNameForToken(aToken)));
-
- // Shorten list to maximal size.
- while (mpMasterPages->size() > mnMaxListSize)
- {
- mpMasterPages->pop_back ();
- }
-
- if (bMakePersistent)
- SavePersistentValues ();
- SendEvent();
- }
-}
-
-
-
-
-void RecentlyUsedMasterPages::ResolveList (void)
-{
- bool bNotify (false);
-
- MasterPageList::iterator iDescriptor;
- for (iDescriptor=mpMasterPages->begin(); iDescriptor!=mpMasterPages->end(); ++iDescriptor)
- {
- if (iDescriptor->maToken == MasterPageContainer::NIL_TOKEN)
- {
- MasterPageContainer::Token aToken (mpContainer->GetTokenForURL(iDescriptor->msURL));
- iDescriptor->maToken = aToken;
- if (aToken != MasterPageContainer::NIL_TOKEN)
- bNotify = true;
- }
- else
- {
- if ( ! mpContainer->HasToken(iDescriptor->maToken))
- {
- iDescriptor->maToken = MasterPageContainer::NIL_TOKEN;
- bNotify = true;
- }
- }
- }
-
- if (bNotify)
- SendEvent();
-}
-
-
-} } } // end of namespace ::sd::toolpanel::controls
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/toolpanel/controls/RecentlyUsedMasterPages.hxx b/sd/source/ui/toolpanel/controls/RecentlyUsedMasterPages.hxx
deleted file mode 100644
index 4d43ae3e784f..000000000000
--- a/sd/source/ui/toolpanel/controls/RecentlyUsedMasterPages.hxx
+++ /dev/null
@@ -1,119 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#ifndef SD_TOOLPANEL_CONTROLS_RECENTLY_USED_MASTER_PAGES_HXX
-#define SD_TOOLPANEL_CONTROLS_RECENTLY_USED_MASTER_PAGES_HXX
-
-#include "tools/SdGlobalResourceContainer.hxx"
-#include <osl/mutex.hxx>
-#include <tools/link.hxx>
-#include <vcl/image.hxx>
-#include <vector>
-
-#include "DrawDocShell.hxx"
-#include "MasterPageContainer.hxx"
-#include <com/sun/star/uno/XInterface.hpp>
-
-namespace sd {
-class MasterPageObserverEvent;
-}
-
-
-namespace sd { namespace toolpanel { namespace controls {
-
-/** This singleton holds a list of the most recently used master pages.
-*/
-class RecentlyUsedMasterPages
- : public SdGlobalResource
-{
-public:
- /** Return the single instance of this class.
- */
- static RecentlyUsedMasterPages& Instance (void);
-
- void AddEventListener (const Link& rEventListener);
- void RemoveEventListener (const Link& rEventListener);
-
- int GetMasterPageCount (void) const;
- MasterPageContainer::Token GetTokenForIndex (sal_uInt32 nIndex) const;
-
-private:
- /** The single instance of this class. It is created on demand when
- Instance() is called for the first time.
- */
- static RecentlyUsedMasterPages* mpInstance;
-
- ::std::vector<Link> maListeners;
-
- class MasterPageList;
- ::std::auto_ptr<MasterPageList> mpMasterPages;
- unsigned long int mnMaxListSize;
- ::boost::shared_ptr<MasterPageContainer> mpContainer;
-
- RecentlyUsedMasterPages (void);
- virtual ~RecentlyUsedMasterPages (void);
-
- /** Call this method after a new object has been created.
- */
- void LateInit (void);
-
- /// The copy constructor is not implemented. Do not use!
- RecentlyUsedMasterPages (const RecentlyUsedMasterPages&);
-
- /// The assignment operator is not implemented. Do not use!
- RecentlyUsedMasterPages& operator= (const RecentlyUsedMasterPages&);
-
- void SendEvent (void);
- DECL_LINK(MasterPageChangeListener, MasterPageObserverEvent*);
- DECL_LINK(MasterPageContainerChangeListener, MasterPageContainerChangeEvent*);
-
- /** Add a descriptor for the specified master page to the end of the
- list of most recently used master pages. When the page is already a
- member of that list the associated descriptor is moved to the end of
- the list to make it the most recently used entry.
- @param bMakePersistent
- When <TRUE/> is given then the new list of recently used master
- pages is written back into the configuration to make it
- persistent. Giving <FALSE/> to ommit this is used while loading
- the persistent list from the configuration.
- */
- void AddMasterPage (
- MasterPageContainer::Token aToken,
- bool bMakePersistent = true);
-
- /** Load the list of recently used master pages from the registry where
- it was saved to make it persistent.
- */
- void LoadPersistentValues (void);
-
- /** Save the list of recently used master pages to the registry to make
- it presistent.
- */
- void SavePersistentValues (void);
-
- void ResolveList (void);
-};
-
-
-
-} } } // end of namespace ::sd::toolpanel::controls
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/toolpanel/controls/SlideTransitionPanel.cxx b/sd/source/ui/toolpanel/controls/SlideTransitionPanel.cxx
deleted file mode 100644
index 6b01a59a03cf..000000000000
--- a/sd/source/ui/toolpanel/controls/SlideTransitionPanel.cxx
+++ /dev/null
@@ -1,109 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#include "SlideTransitionPanel.hxx"
-
-#include "taskpane/TaskPaneControlFactory.hxx"
-#include "taskpane/ToolPanelViewShell.hxx"
-
-#include "strings.hrc"
-#include "sdresid.hxx"
-#include <com/sun/star/frame/XModel.hpp>
-
-namespace sd
-{
-
- class ViewShellBase;
- extern ::Window * createSlideTransitionPanel( ::Window* pParent, ViewShellBase& rBase,
- const cssu::Reference<css::frame::XFrame>& rxFrame );
-
-namespace toolpanel { namespace controls {
-
-
-
-SlideTransitionPanel::SlideTransitionPanel(Window& i_rParentWindow, ToolPanelViewShell& i_rToolPanelShell)
- :SubToolPanel( i_rParentWindow )
- ,maPreferredSize( 100, 200 )
- ,m_pPanelViewShell( &i_rToolPanelShell )
-{
- mpWrappedControl = createSlideTransitionPanel( &i_rParentWindow, i_rToolPanelShell.GetViewShellBase(), NULL );
- mpWrappedControl->Show();
-}
-
-SlideTransitionPanel::~SlideTransitionPanel()
-{
- delete mpWrappedControl;
-}
-
-std::auto_ptr< ControlFactory > SlideTransitionPanel::CreateControlFactory( ToolPanelViewShell& i_rToolPanelShell )
-{
- return std::auto_ptr< ControlFactory >(
- new RootControlFactoryWithArg< SlideTransitionPanel, ToolPanelViewShell >( i_rToolPanelShell ) );
-}
-
-TaskPaneShellManager* SlideTransitionPanel::GetShellManager()
-{
- if ( m_pPanelViewShell )
- return &m_pPanelViewShell->GetSubShellManager();
- return SubToolPanel::GetShellManager();
-}
-
-Size SlideTransitionPanel::GetPreferredSize()
-{
- return maPreferredSize;
-}
-sal_Int32 SlideTransitionPanel::GetPreferredWidth(sal_Int32 )
-{
- return maPreferredSize.Width();
-}
-sal_Int32 SlideTransitionPanel::GetPreferredHeight(sal_Int32 )
-{
- return maPreferredSize.Height();
-}
-::Window* SlideTransitionPanel::GetWindow()
-{
- return mpWrappedControl;
-}
-bool SlideTransitionPanel::IsResizable()
-{
- return true;
-}
-bool SlideTransitionPanel::IsExpandable() const
-{
- return true;
-}
-
-
-
-
-::com::sun::star::uno::Reference<
- ::com::sun::star::accessibility::XAccessible> SlideTransitionPanel::CreateAccessibleObject (
- const ::com::sun::star::uno::Reference<
- ::com::sun::star::accessibility::XAccessible>& )
-{
- if (GetWindow() != NULL)
- return GetWindow()->GetAccessible();
- else
- return NULL;
-}
-
-
-} } } // end of namespace ::sd::toolpanel::controls
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/toolpanel/controls/SlideTransitionPanel.hxx b/sd/source/ui/toolpanel/controls/SlideTransitionPanel.hxx
deleted file mode 100644
index a3671c3d68d0..000000000000
--- a/sd/source/ui/toolpanel/controls/SlideTransitionPanel.hxx
+++ /dev/null
@@ -1,71 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-#ifndef SD_TOOLPANEL_CONTROLS_SLIDE_TRANSITION_PANEL_HXX
-#define SD_TOOLPANEL_CONTROLS_SLIDE_TRANSITION_PANEL_HXX
-
-#include "taskpane/SubToolPanel.hxx"
-
-namespace sd { namespace toolpanel {
-class ControlFactory;
-class TreeNode;
-class ToolPanelViewShell;
-} }
-
-namespace sd { namespace toolpanel { namespace controls {
-
-class SlideTransitionPanel
- : public SubToolPanel
-{
-public:
- SlideTransitionPanel (
- Window& i_rParentWindow,
- ToolPanelViewShell& i_rToolPanelShell);
- virtual ~SlideTransitionPanel (void);
-
- static std::auto_ptr<ControlFactory> CreateControlFactory (ToolPanelViewShell& i_rToolPanelShell);
-
- // TreeNode overridables
- virtual TaskPaneShellManager* GetShellManager();
-
- // ILayoutableWindow overridables
- virtual Size GetPreferredSize (void);
- virtual sal_Int32 GetPreferredWidth (sal_Int32 nHeigh);
- virtual sal_Int32 GetPreferredHeight (sal_Int32 nWidth);
- virtual ::Window* GetWindow (void);
- virtual bool IsResizable (void);
- virtual bool IsExpandable (void) const;
-
- virtual ::com::sun::star::uno::Reference<
- ::com::sun::star::accessibility::XAccessible > CreateAccessibleObject (
- const ::com::sun::star::uno::Reference<
- ::com::sun::star::accessibility::XAccessible>& rxParent);
-
- using Window::GetWindow;
-
-private:
- Size maPreferredSize;
- ::Window* mpWrappedControl;
- ToolPanelViewShell* m_pPanelViewShell;
-};
-
-} } } // end of namespace ::sd::toolpanel::controls
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/toolpanel/controls/TableDesignPanel.cxx b/sd/source/ui/toolpanel/controls/TableDesignPanel.cxx
deleted file mode 100644
index e75d7f4abb21..000000000000
--- a/sd/source/ui/toolpanel/controls/TableDesignPanel.cxx
+++ /dev/null
@@ -1,102 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-
-#include "TableDesignPanel.hxx"
-
-#include "taskpane/TaskPaneControlFactory.hxx"
-#include "taskpane/ToolPanelViewShell.hxx"
-
-#include "strings.hrc"
-#include "sdresid.hxx"
-
-namespace sd
-{
-
- class ViewShellBase;
- extern ::Window * createTableDesignPanel( ::Window* pParent, ViewShellBase& rBase );
-
-namespace toolpanel { namespace controls {
-
-
-TableDesignPanel::TableDesignPanel( ::Window& i_rParentWindow, ToolPanelViewShell& i_rPanelViewShell )
- :SubToolPanel( i_rParentWindow )
- ,m_pPanelViewShell( &i_rPanelViewShell )
-{
- mpWrappedControl = createTableDesignPanel( &i_rParentWindow, i_rPanelViewShell.GetViewShellBase() );
- mpWrappedControl->Show();
-}
-
-TableDesignPanel::~TableDesignPanel()
-{
- delete mpWrappedControl;
-}
-
-std::auto_ptr< ControlFactory > TableDesignPanel::CreateControlFactory( ToolPanelViewShell& i_rToolPanelShell )
-{
- return std::auto_ptr< ControlFactory >(
- new RootControlFactoryWithArg< TableDesignPanel, ToolPanelViewShell >( i_rToolPanelShell ) );
-}
-
-TaskPaneShellManager* TableDesignPanel::GetShellManager()
-{
- if ( m_pPanelViewShell )
- return &m_pPanelViewShell->GetSubShellManager();
- return SubToolPanel::GetShellManager();
-}
-
-Size TableDesignPanel::GetPreferredSize()
-{
- return maPreferredSize;
-}
-sal_Int32 TableDesignPanel::GetPreferredWidth(sal_Int32 )
-{
- return maPreferredSize.Width();
-}
-sal_Int32 TableDesignPanel::GetPreferredHeight(sal_Int32 )
-{
- return maPreferredSize.Height();
-}
-::Window* TableDesignPanel::GetWindow()
-{
- return mpWrappedControl;
-}
-bool TableDesignPanel::IsResizable()
-{
- return true;
-}
-bool TableDesignPanel::IsExpandable() const
-{
- return true;
-}
-
-::com::sun::star::uno::Reference<
- ::com::sun::star::accessibility::XAccessible> TableDesignPanel::CreateAccessibleObject (
- const ::com::sun::star::uno::Reference<
- ::com::sun::star::accessibility::XAccessible>& )
-{
- if (GetWindow() != NULL)
- return GetWindow()->GetAccessible();
- else
- return NULL;
-}
-
-} } } // end of namespace ::sd::toolpanel::controls
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/toolpanel/controls/TableDesignPanel.hxx b/sd/source/ui/toolpanel/controls/TableDesignPanel.hxx
deleted file mode 100644
index 82e862d0a0a6..000000000000
--- a/sd/source/ui/toolpanel/controls/TableDesignPanel.hxx
+++ /dev/null
@@ -1,71 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#ifndef SD_TOOLPANEL_CONTROLS_TABLE_DESIGN_PANEL_HXX
-#define SD_TOOLPANEL_CONTROLS_TABLE_DESIGN_PANEL_HXX
-
-#include "taskpane/SubToolPanel.hxx"
-
-namespace sd { namespace toolpanel {
-class TreeNode;
-class ControlFactory;
-class ToolPanelViewShell;
-} }
-
-namespace sd { namespace toolpanel { namespace controls {
-
-class TableDesignPanel
- : public SubToolPanel
-{
-public:
- TableDesignPanel (
- ::Window& i_rParentWindow,
- ToolPanelViewShell& i_rPanelViewShell);
- virtual ~TableDesignPanel (void);
-
- static std::auto_ptr<ControlFactory> CreateControlFactory (ToolPanelViewShell& i_rToolPanelShell);
-
- // TreeNode overridables
- virtual TaskPaneShellManager* GetShellManager();
-
- // ILayoutableWindow overridables
- virtual Size GetPreferredSize (void);
- virtual sal_Int32 GetPreferredWidth (sal_Int32 nHeigh);
- virtual sal_Int32 GetPreferredHeight (sal_Int32 nWidth);
- virtual ::Window* GetWindow (void);
- virtual bool IsResizable (void);
- virtual bool IsExpandable (void) const;
-
- virtual ::com::sun::star::uno::Reference<
- ::com::sun::star::accessibility::XAccessible > CreateAccessibleObject (
- const ::com::sun::star::uno::Reference<
- ::com::sun::star::accessibility::XAccessible>& rxParent);
-
- using Window::GetWindow;
-private:
- Size maPreferredSize;
- ::Window* mpWrappedControl;
- ToolPanelViewShell* m_pPanelViewShell;
-};
-
-} } } // end of namespace ::sd::toolpanel::controls
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/unoidl/facreg.cxx b/sd/source/ui/unoidl/facreg.cxx
index c1445b5beb8d..df50159dc2e7 100644
--- a/sd/source/ui/unoidl/facreg.cxx
+++ b/sd/source/ui/unoidl/facreg.cxx
@@ -113,13 +113,6 @@ extern OUString BasicViewFactory_getImplementationName(void) throw (uno::Runtime
extern uno::Sequence<OUString> SAL_CALL BasicViewFactory_getSupportedServiceNames (void)
throw (uno::RuntimeException);
-extern uno::Reference<uno::XInterface> SAL_CALL TaskPanelFactory_createInstance(
- const uno::Reference<uno::XComponentContext>& rxContext)
- throw(uno::Exception);
-extern OUString TaskPanelFactory_getImplementationName(void) throw (uno::RuntimeException);
-extern uno::Sequence<OUString> SAL_CALL TaskPanelFactory_getSupportedServiceNames (void)
- throw (uno::RuntimeException);
-
extern uno::Reference<uno::XInterface> SAL_CALL ResourceId_createInstance(
const uno::Reference<uno::XComponentContext>& rxContext)
throw(uno::Exception);
@@ -147,16 +140,6 @@ extern uno::Sequence<OUString> SAL_CALL PanelFactory_getSupportedServiceNames (v
} }
-namespace sd { namespace toolpanel {
-extern uno::Reference<uno::XInterface> SAL_CALL ToolPanelFactory_createInstance(
- const uno::Reference<uno::XComponentContext>& rxContext)
- throw(uno::Exception);
-extern OUString ToolPanelFactory_getImplementationName(void) throw (uno::RuntimeException);
-extern uno::Sequence<OUString> SAL_CALL ToolPanelFactory_getSupportedServiceNames (void)
- throw (uno::RuntimeException);
-
-} }
-
namespace sd { namespace presenter {
extern uno::Reference<uno::XInterface> SAL_CALL SlideRenderer_createInstance(
const uno::Reference<uno::XComponentContext>& rxContext)
@@ -215,7 +198,6 @@ using namespace ::sd::framework;
using namespace ::sd::presenter;
using namespace ::sd::slidesorter;
using namespace ::sd::sidebar;
-using namespace ::sd::toolpanel;
@@ -238,8 +220,6 @@ enum FactoryId
BasicPaneFactoryFactoryId,
BasicToolBarFactoryFactoryId,
BasicViewFactoryFactoryId,
- TaskPanelFactoryFactoryId,
- ToolPanelFactoryFactoryId,
PanelFactoryFactoryId,
ResourceIdFactoryId,
PresentationFactoryProviderFactoryId,
@@ -273,9 +253,7 @@ static ::boost::shared_ptr<FactoryMap> spFactoryMap;
(*spFactoryMap)[BasicPaneFactory_getImplementationName()] = BasicPaneFactoryFactoryId;
(*spFactoryMap)[BasicToolBarFactory_getImplementationName()] = BasicToolBarFactoryFactoryId;
(*spFactoryMap)[BasicViewFactory_getImplementationName()] = BasicViewFactoryFactoryId;
- (*spFactoryMap)[TaskPanelFactory_getImplementationName()] = TaskPanelFactoryFactoryId;
- (*spFactoryMap)[ToolPanelFactory_getImplementationName()] = ToolPanelFactoryFactoryId;
- (*spFactoryMap)[PanelFactory_getImplementationName()] = PanelFactoryFactoryId;
+ (*spFactoryMap)[sidebar::PanelFactory_getImplementationName()] = PanelFactoryFactoryId;
(*spFactoryMap)[ResourceId_getImplementationName()] = ResourceIdFactoryId;
(*spFactoryMap)[PresentationFactoryProvider_getImplementationName()] = PresentationFactoryProviderFactoryId;
(*spFactoryMap)[SlideRenderer_getImplementationName()] = SlideRendererFactoryId;
@@ -398,20 +376,6 @@ SAL_DLLPUBLIC_EXPORT void * SAL_CALL sd_component_getFactory(
sd::framework::BasicViewFactory_getSupportedServiceNames());
break;
- case TaskPanelFactoryFactoryId:
- xComponentFactory = ::cppu::createSingleComponentFactory(
- sd::framework::TaskPanelFactory_createInstance,
- sd::framework::TaskPanelFactory_getImplementationName(),
- sd::framework::TaskPanelFactory_getSupportedServiceNames());
- break;
-
- case ToolPanelFactoryFactoryId:
- xComponentFactory = ::cppu::createSingleComponentFactory(
- sd::toolpanel::ToolPanelFactory_createInstance,
- sd::toolpanel::ToolPanelFactory_getImplementationName(),
- sd::toolpanel::ToolPanelFactory_getSupportedServiceNames());
- break;
-
case PanelFactoryFactoryId:
xComponentFactory = ::cppu::createSingleComponentFactory(
sd::sidebar::PanelFactory_createInstance,
diff --git a/sd/source/ui/view/ToolBarManager.cxx b/sd/source/ui/view/ToolBarManager.cxx
index 65e0f71ac63c..8c5fb7678558 100644
--- a/sd/source/ui/view/ToolBarManager.cxx
+++ b/sd/source/ui/view/ToolBarManager.cxx
@@ -1203,7 +1203,6 @@ void ToolBarRules::MainViewShellChanged (ViewShell::ShellType nShellType)
case ViewShell::ST_NONE:
case ViewShell::ST_PRESENTATION:
- case ViewShell::ST_TASK_PANE:
case ViewShell::ST_SIDEBAR:
default:
break;
diff --git a/sd/source/ui/view/ViewShellBase.cxx b/sd/source/ui/view/ViewShellBase.cxx
index 7228dd830905..d683d4e3bb36 100644
--- a/sd/source/ui/view/ViewShellBase.cxx
+++ b/sd/source/ui/view/ViewShellBase.cxx
@@ -54,7 +54,6 @@
#include "PresentationViewShell.hxx"
#include "FormShellManager.hxx"
#include "ToolBarManager.hxx"
-#include "taskpane/PanelId.hxx"
#include "SidebarPanelId.hxx"
#include "Window.hxx"
#include "framework/ConfigurationController.hxx"
@@ -691,13 +690,6 @@ void ViewShellBase::Execute (SfxRequest& rRequest)
framework::FrameworkHelper::msSlideSorterURL);
break;
- case SID_TASKPANE:
- mpImpl->SetPaneVisibility(
- rRequest,
- framework::FrameworkHelper::msRightPaneURL,
- framework::FrameworkHelper::msTaskPaneURL);
- break;
-
case SID_NORMAL_MULTI_PANE_GUI:
case SID_SLIDE_SORTER_MULTI_PANE_GUI:
case SID_DRAWINGMODE:
@@ -1387,11 +1379,6 @@ void ViewShellBase::Implementation::GetSlotState (SfxItemSet& rSet)
xContext, FrameworkHelper::msLeftDrawPaneURL);
break;
- case SID_TASKPANE:
- xResourceId = ResourceId::create(
- xContext, FrameworkHelper::msRightPaneURL);
- break;
-
case SID_NORMAL_MULTI_PANE_GUI:
xResourceId = ResourceId::createWithAnchorURL(
xContext,
diff --git a/sd/source/ui/view/ViewShellImplementation.cxx b/sd/source/ui/view/ViewShellImplementation.cxx
index 8fdcb847fd60..574e3cd4362a 100644
--- a/sd/source/ui/view/ViewShellImplementation.cxx
+++ b/sd/source/ui/view/ViewShellImplementation.cxx
@@ -40,7 +40,6 @@
#include "FrameView.hxx"
#include "DrawViewShell.hxx"
#include "ViewShellHint.hxx"
-#include "taskpane/PanelId.hxx"
#include "SidebarPanelId.hxx"
#include "framework/FrameworkHelper.hxx"
@@ -331,7 +330,6 @@ sal_uInt16 ViewShell::Implementation::GetViewId (void)
// Since we have to return a view id for every possible shell type
// and there is not (yet) a proper ViewShellBase sub class for the
// remaining types we chose the Impress factory as a fall back.
- case ViewShell::ST_TASK_PANE:
case ViewShell::ST_SIDEBAR:
case ViewShell::ST_NONE:
default:
diff --git a/sd/util/sd.component b/sd/util/sd.component
index 552e2d56a987..a5881659edcc 100644
--- a/sd/util/sd.component
+++ b/sd/util/sd.component
@@ -63,9 +63,6 @@
<implementation name="com.sun.star.comp.Draw.framework.ResourceId">
<service name="com.sun.star.drawing.framework.ResourceId"/>
</implementation>
- <implementation name="com.sun.star.comp.Draw.framework.TaskPanelFactory">
- <service name="com.sun.star.drawing.framework.TaskPanelFactory"/>
- </implementation>
<implementation name="org.openoffice.comp.Draw.framework.PanelFactory">
<service name="com.sun.star.drawing.framework.PanelFactory"/>
</implementation>
@@ -81,9 +78,6 @@
<implementation name="com.sun.star.comp.draw.SdHtmlOptionsDialog">
<service name="com.sun.star.ui.dialog.FilterOptionsDialog"/>
</implementation>
- <implementation name="com.sun.star.comp.drawing.ToolPanelFactory">
- <service name="com.sun.star.drawing.DefaultToolPanelFactory"/>
- </implementation>
<implementation name="com.sun.star.comp.sd.InsertSlideController">
<service name="com.sun.star.frame.ToolbarController"/>
</implementation>
diff --git a/sfx2/source/sidebar/SidebarChildWindow.cxx b/sfx2/source/sidebar/SidebarChildWindow.cxx
index 2a75ff4936ba..10afde2af123 100644
--- a/sfx2/source/sidebar/SidebarChildWindow.cxx
+++ b/sfx2/source/sidebar/SidebarChildWindow.cxx
@@ -23,7 +23,6 @@
#include "sfx2/sfxsids.hrc"
#include "helpid.hrc"
#include "sfx2/dockwin.hxx"
-#include "sfx2/viewfrm.hxx"
#include <sfx2/sidebar/ResourceDefinitions.hrc>
@@ -75,13 +74,6 @@ sal_Int32 SidebarChildWindow::GetDefaultWidth (Window* pWindow)
return 0;
}
-void SidebarChildWindow::RegisterChildWindowIfEnabled (sal_Bool bVisible,
- SfxModule *pMod,
- sal_uInt16 nFlags)
-{
- if ( SfxViewFrame::IsSidebarEnabled() )
- RegisterChildWindow( bVisible, pMod, nFlags );
-}
} } // end of namespace sfx2::sidebar
diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx
index b6b04da468dd..4c38e00d156b 100644
--- a/sfx2/source/view/viewfrm.cxx
+++ b/sfx2/source/view/viewfrm.cxx
@@ -30,8 +30,7 @@
#include <com/sun/star/frame/XLoadable.hpp>
#include <com/sun/star/frame/XLayoutManager.hpp>
#include <com/sun/star/frame/XComponentLoader.hpp>
-#include <com/sun/star/ui/UIElementFactoryManager.hpp>
-
+#include "officecfg/Office/Common.hxx"
#include <toolkit/helper/vclunohelper.hxx>
#include <vcl/splitwin.hxx>
#include <unotools/moduleoptions.hxx>
@@ -91,10 +90,6 @@
#include <svtools/svtresid.hxx>
#include <framework/framelistanalyzer.hxx>
-#include <comphelper/processfactory.hxx>
-#include <comphelper/configuration.hxx>
-#include <officecfg/Office/Common.hxx>
-
#include <boost/optional.hpp>
using namespace ::com::sun::star;
@@ -3200,7 +3195,7 @@ void SfxViewFrame::ChildWindowState( SfxItemSet& rState )
}
else if ( nSID == SID_TASKPANE )
{
- if ( !KnowsChildWindow( nSID ) )
+ if ( !KnowsChildWindow( nSID ) )
{
OSL_FAIL( "SID_TASKPANE state requested, but no task pane child window exists for this ID!" );
rState.DisableItem( nSID );
@@ -3216,11 +3211,6 @@ void SfxViewFrame::ChildWindowState( SfxItemSet& rState )
}
else if ( nSID == SID_SIDEBAR )
{
- if ( !IsSidebarEnabled() )
- {
- rState.DisableItem( nSID );
- rState.Put( SfxVisibilityItem( nSID, sal_False ) );
- }
if ( !KnowsChildWindow( nSID ) )
{
OSL_ENSURE( false, "SID_TASKPANE state requested, but no task pane child window exists for this ID!" );
@@ -3380,48 +3370,4 @@ void SfxViewFrame::RemoveInfoBar( const OUString& sId )
}
}
-bool SfxViewFrame::IsSidebarEnabled()
-{
- static bool bInitialized = false;
- static bool bEnabled = false;
-
- // read the setting once at start, and that's what we
- // stick with for now.
- if (!bInitialized)
- {
- bInitialized = true;
- css::uno::Reference< css::uno::XComponentContext > xContext;
- xContext = ::comphelper::getProcessComponentContext();
- try {
- bEnabled = officecfg::Office::Common::Misc::ExperimentalSidebar::get( xContext );
- } catch (const uno::Exception &) {
- SAL_WARN("sfx.view", "don't have experimental sidebar option installed");
- }
-
- // rip out the services from framework/ for good measure
- try
- {
- uno::Reference< ui::XUIElementFactoryManager > xUIElementFactory = ui::UIElementFactoryManager::create( xContext );
- if( !bEnabled )
- {
- xUIElementFactory->deregisterFactory( "toolpanel", "ScPanelFactory", "" );
- xUIElementFactory->deregisterFactory( "toolpanel", "SwPanelFactory", "" );
- xUIElementFactory->deregisterFactory( "toolpanel", "SvxPanelFactory", "" );
- xUIElementFactory->deregisterFactory( "toolpanel", "SdPanelFactory", "" );
- }
- else
- {
- xUIElementFactory->deregisterFactory( "toolpanel", "DrawingFramework",
- "com.sun.star.presentation.PresentationDocument" );
- }
- }
- catch ( const uno::Exception &e )
- {
- SAL_WARN( "sfx.view", "Exception de-registering sidebar factories " << e.Message );
- }
- }
-
- return bEnabled;
-}
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svtools/source/config/miscopt.cxx b/svtools/source/config/miscopt.cxx
index fc5aac873a2e..3a600333ada7 100644
--- a/svtools/source/config/miscopt.cxx
+++ b/svtools/source/config/miscopt.cxx
@@ -62,10 +62,8 @@ using namespace ::com::sun::star;
#define PROPERTYHANDLE_ALWAYSALLOWSAVE 8
#define PROPERTYNAME_EXPERIMENTALMODE "ExperimentalMode"
#define PROPERTYHANDLE_EXPERIMENTALMODE 9
-#define PROPERTYNAME_MACRORECORDERMODE "MacroRecorderMode"
+#define PROPERTYNAME_MACRORECORDERMODE "MacroRecorderMode"
#define PROPERTYHANDLE_MACRORECORDERMODE 10
-#define PROPERTYNAME_EXPERIMENTALSIDEBAR "ExperimentalSidebar"
-#define PROPERTYHANDLE_EXPERIMENTALSIDEBAR 11
#define VCL_TOOLBOX_STYLE_FLAT ((sal_uInt16)0x0004) // from <vcl/toolbox.hxx>
@@ -89,7 +87,6 @@ class SvtMiscOptions_Impl : public ConfigItem
sal_Bool m_bDisableUICustomization;
sal_Bool m_bAlwaysAllowSave;
sal_Bool m_bExperimentalMode;
- sal_Bool m_bExperimentalSidebar;
sal_Bool m_bMacroRecorderMode;
public:
@@ -162,12 +159,6 @@ class SvtMiscOptions_Impl : public ConfigItem
inline sal_Bool IsExperimentalMode() const
{ return m_bExperimentalMode; }
- inline void SetExperimentalSidebar( sal_Bool bSet )
- { m_bExperimentalSidebar = bSet; SetModified(); }
-
- inline sal_Bool IsExperimentalSidebar() const
- { return m_bExperimentalSidebar; }
-
inline void SetMacroRecorderMode( sal_Bool bSet )
{ m_bMacroRecorderMode = bSet; SetModified(); }
@@ -280,7 +271,6 @@ SvtMiscOptions_Impl::SvtMiscOptions_Impl()
, m_bIsShowLinkWarningDialogRO( sal_False )
, m_bAlwaysAllowSave( sal_False )
, m_bExperimentalMode( sal_False )
- , m_bExperimentalSidebar( sal_False )
, m_bMacroRecorderMode( sal_False )
{
@@ -400,12 +390,6 @@ SvtMiscOptions_Impl::SvtMiscOptions_Impl()
OSL_FAIL("Wrong type of \"Misc\\MacroRecorderMode\"!" );
break;
}
- case PROPERTYHANDLE_EXPERIMENTALSIDEBAR :
- {
- if( !(seqValues[nProperty] >>= m_bExperimentalSidebar) )
- OSL_FAIL("Wrong type of \"Misc\\ExperimentalSidebar\"!" );
- break;
- }
}
}
@@ -688,11 +672,6 @@ void SvtMiscOptions_Impl::Commit()
seqValues[nProperty] <<= m_bMacroRecorderMode;
break;
}
- case PROPERTYHANDLE_EXPERIMENTALSIDEBAR :
- {
- seqValues[nProperty] <<= m_bExperimentalSidebar;
- break;
- }
}
}
// Set properties in configuration.
@@ -717,8 +696,7 @@ Sequence< OUString > SvtMiscOptions_Impl::GetPropertyNames()
OUString(PROPERTYNAME_DISABLEUICUSTOMIZATION),
OUString(PROPERTYNAME_ALWAYSALLOWSAVE),
OUString(PROPERTYNAME_EXPERIMENTALMODE),
- OUString(PROPERTYNAME_MACRORECORDERMODE),
- OUString(PROPERTYNAME_EXPERIMENTALSIDEBAR)
+ OUString(PROPERTYNAME_MACRORECORDERMODE)
};
// Initialize return sequence with these list ...
@@ -898,16 +876,6 @@ sal_Bool SvtMiscOptions::IsExperimentalMode() const
return m_pDataContainer->IsExperimentalMode();
}
-void SvtMiscOptions::SetExperimentalSidebar( sal_Bool bSet )
-{
- m_pDataContainer->SetExperimentalSidebar( bSet );
-}
-
-sal_Bool SvtMiscOptions::IsExperimentalSidebar() const
-{
- return m_pDataContainer->IsExperimentalSidebar();
-}
-
void SvtMiscOptions::SetMacroRecorderMode( sal_Bool bSet )
{
m_pDataContainer->SetMacroRecorderMode( bSet );
diff --git a/svtools/source/dialogs/restartdialog.cxx b/svtools/source/dialogs/restartdialog.cxx
index 81655a5dc8c3..e5d64dec0bc6 100644
--- a/svtools/source/dialogs/restartdialog.cxx
+++ b/svtools/source/dialogs/restartdialog.cxx
@@ -40,9 +40,6 @@ public:
case svtools::RESTART_REASON_BIBLIOGRAPHY_INSTALL:
get(reason_, "reason_bibliography_install");
break;
- case svtools::RESTART_REASON_MODIFIED_SIDEBAR:
- get(reason_, "reason_sidebar");
- break;
default:
assert(false); // this cannot happen
}
diff --git a/svtools/uiconfig/ui/restartdialog.ui b/svtools/uiconfig/ui/restartdialog.ui
index f2445df4e24c..5027620b485e 100644
--- a/svtools/uiconfig/ui/restartdialog.ui
+++ b/svtools/uiconfig/ui/restartdialog.ui
@@ -101,20 +101,6 @@
</packing>
</child>
<child>
- <object class="GtkLabel" id="reason_sidebar">
- <property name="can_focus">False</property>
- <property name="no_show_all">True</property>
- <property name="label" translatable="yes">For the modified sidebar setting to take effect, %PRODUCTNAME must be restarted.</property>
- <property name="wrap">True</property>
- <property name="max_width_chars">50</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">3</property>
- </packing>
- </child>
- <child>
<object class="GtkLabel" id="label">
<property name="visible">True</property>
<property name="can_focus">False</property>
@@ -124,7 +110,7 @@
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
- <property name="position">4</property>
+ <property name="position">3</property>
</packing>
</child>
</object>
diff --git a/sw/source/ui/app/swmodule.cxx b/sw/source/ui/app/swmodule.cxx
index c903c4af1192..72f745f58a0c 100644
--- a/sw/source/ui/app/swmodule.cxx
+++ b/sw/source/ui/app/swmodule.cxx
@@ -400,7 +400,7 @@ void SwDLL::RegisterControls()
::avmedia::MediaPlayer::RegisterChildWindow(0, pMod);
SvxSmartTagsControl::RegisterControl(SID_OPEN_SMARTTAGMENU, pMod);
- ::sfx2::sidebar::SidebarChildWindow::RegisterChildWindowIfEnabled(0, pMod);
+ ::sfx2::sidebar::SidebarChildWindow::RegisterChildWindow(0, pMod);
::sfx2::TaskPaneWrapper::RegisterChildWindow(0, pMod);
}