You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openoffice.apache.org by st...@apache.org on 2013/04/23 11:51:53 UTC
svn commit: r1470868 [16/40] - in /openoffice/branches/ia2: ./
ext_libraries/coinmp/ ext_libraries/serf/ ext_libraries/serf/win/
extras/l10n/source/fi/ main/ main/animations/source/animcore/
main/automation/source/communi/ main/basctl/source/basicide/ ...
Modified: openoffice/branches/ia2/main/sd/source/ui/view/sdview.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/ia2/main/sd/source/ui/view/sdview.cxx?rev=1470868&r1=1470867&r2=1470868&view=diff
==============================================================================
--- openoffice/branches/ia2/main/sd/source/ui/view/sdview.cxx (original)
+++ openoffice/branches/ia2/main/sd/source/ui/view/sdview.cxx Tue Apr 23 09:51:15 2013
@@ -51,11 +51,13 @@
#include <svx/dialogs.hrc>
#include <sfx2/viewfrm.hxx>
+#include <sfx2/sidebar/EnumContext.hxx>
#include <svx/svdopage.hxx>
#include <toolkit/helper/vclunohelper.hxx>
#include <svx/xlndsit.hxx>
#include <svx/xlineit0.hxx>
#include <svx/xlnclit.hxx>
+#include <svx/sidebar/ContextChangeEventMultiplexer.hxx>
#include <vcl/virdev.hxx>
#include "app.hrc"
@@ -79,6 +81,7 @@
#include <svx/sdr/contact/viewobjectcontact.hxx>
#include <svx/sdr/contact/viewcontact.hxx>
#include <svx/sdr/contact/displayinfo.hxx>
+#include <svx/svdotable.hxx>
#include "EventMultiplexer.hxx"
#include "ViewShellBase.hxx"
#include "ViewShellManager.hxx"
@@ -89,6 +92,7 @@
#include <drawinglayer/primitive2d/textlayoutdevice.hxx>
#include <drawinglayer/primitive2d/groupprimitive2d.hxx>
#include <svx/sdr/contact/objectcontact.hxx>
+#include <svx/sdr/table/tablecontroller.hxx>
#include <basegfx/matrix/b2dhommatrix.hxx>
#include <drawinglayer/primitive2d/textprimitive2d.hxx>
#include <svx/unoapi.hxx>
@@ -98,6 +102,7 @@
using namespace com::sun::star;
using namespace com::sun::star::uno;
+using namespace sdr::table;
namespace sd {
#ifndef SO2_DECL_SVINPLACEOBJECT_DEFINED
@@ -775,6 +780,10 @@ sal_Bool View::SdrBeginTextEdit(
pGivenOutlinerView, bDontDeleteOutliner,
bOnlyOneView, bGrabFocus);
+ ContextChangeEventMultiplexer::NotifyContextChange(
+ &GetViewShell()->GetViewShellBase(),
+ ::sfx2::sidebar::EnumContext::Context_DrawText);
+
if (bReturn)
{
::Outliner* pOL = GetTextEditOutliner();
@@ -790,11 +799,15 @@ sal_Bool View::SdrBeginTextEdit(
{
aBackground = pObj->GetPage()->GetPageBackgroundColor(pPV);
}
- pOL->SetBackgroundColor( aBackground );
+ if (pOL != NULL)
+ pOL->SetBackgroundColor( aBackground );
}
- pOL->SetParaInsertedHdl(LINK(this, View, OnParagraphInsertedHdl));
- pOL->SetParaRemovingHdl(LINK(this, View, OnParagraphRemovingHdl));
+ if (pOL != NULL)
+ {
+ pOL->SetParaInsertedHdl(LINK(this, View, OnParagraphInsertedHdl));
+ pOL->SetParaRemovingHdl(LINK(this, View, OnParagraphRemovingHdl));
+ }
}
return(bReturn);
@@ -831,11 +844,17 @@ SdrEndTextEditKind View::SdrEndTextEdit(
}
}
- GetViewShell()->GetViewShellBase().GetEventMultiplexer()->MultiplexEvent(sd::tools::EventMultiplexerEvent::EID_END_TEXT_EDIT, (void*)xObj.get() );
+ GetViewShell()->GetViewShellBase().GetEventMultiplexer()->MultiplexEvent(
+ sd::tools::EventMultiplexerEvent::EID_END_TEXT_EDIT,
+ (void*)xObj.get() );
if( xObj.is() )
{
- SdPage* pPage = dynamic_cast< SdPage* >( xObj->GetPage() );
+ ContextChangeEventMultiplexer::NotifyContextChange(
+ &GetViewShell()->GetViewShellBase(),
+ ::sfx2::sidebar::EnumContext::Context_Default);
+
+ SdPage* pPage = dynamic_cast< SdPage* >( xObj->GetPage() );
if( pPage )
pPage->onEndTextEdit( xObj.get() );
}
@@ -1314,4 +1333,167 @@ void View::OnEndPasteOrDrop( PasteOrDrop
}
}
+sal_Bool View::ShouldToggleOn(sal_Bool bBulletOnOffMode, sal_Bool bNormalBullet)
+{
+ // If setting bullets/numbering by the dialog, always should toggle on.
+ if (!bBulletOnOffMode)
+ return sal_True;
+ SdrModel* pSdrModel = GetModel();
+ if (!pSdrModel)
+ return sal_False;
+
+ sal_Bool bToggleOn = sal_False;
+ SdrOutliner* pOutliner = SdrMakeOutliner(OUTLINERMODE_TEXTOBJECT, pSdrModel);
+ sal_uInt32 nMarkCount = GetMarkedObjectCount();
+ for (sal_uInt32 nIndex = 0; nIndex < nMarkCount && !bToggleOn; nIndex++)
+ {
+ SdrTextObj* pTextObj = dynamic_cast< SdrTextObj* >(GetMarkedObjectByIndex(nIndex));
+ if (!pTextObj || pTextObj->IsTextEditActive())
+ continue;
+ if (pTextObj->ISA(SdrTableObj))
+ {
+ SdrTableObj* pTableObj = dynamic_cast< SdrTableObj* >(pTextObj);
+ if (!pTableObj)
+ continue;
+ CellPos aStart, aEnd;
+ SvxTableController* pTableController = dynamic_cast< SvxTableController* >(getSelectionController().get());
+ if (pTableController)
+ {
+ pTableController->getSelectedCells(aStart, aEnd);
+ }
+ else
+ {
+ aStart = pTableObj->getFirstCell();
+ aEnd = pTableObj->getLastCell();
+ }
+ sal_Int32 nColCount = pTableObj->getColumnCount();
+ for (sal_Int32 nRow = aStart.mnRow; nRow <= aEnd.mnRow && !bToggleOn; nRow++)
+ {
+ for (sal_Int32 nCol = aStart.mnCol; nCol <= aEnd.mnCol && !bToggleOn; nCol++)
+ {
+ sal_Int32 nIndex = nRow * nColCount + nCol;
+ SdrText* pText = pTableObj->getText(nIndex);
+ if (!pText || !pText->GetOutlinerParaObject())
+ continue;
+ pOutliner->SetText(*(pText->GetOutlinerParaObject()));
+ sal_Int16 nStatus = pOutliner->GetBulletsNumberingStatus();
+ bToggleOn = ((bNormalBullet && nStatus != 0) || (!bNormalBullet && nStatus != 1)) ? sal_True : bToggleOn;
+ pOutliner->Clear();
+ }
+ }
+ }
+ else
+ {
+ OutlinerParaObject* pParaObj = pTextObj->GetOutlinerParaObject();
+ if (!pParaObj)
+ continue;
+ pOutliner->SetText(*pParaObj);
+ sal_Int16 nStatus = pOutliner->GetBulletsNumberingStatus();
+ bToggleOn = ((bNormalBullet && nStatus != 0) || (!bNormalBullet && nStatus != 1)) ? sal_True : bToggleOn;
+ pOutliner->Clear();
+ }
+ }
+ delete pOutliner;
+ return bToggleOn;
+}
+
+void View::ToggleMarkedObjectsBullets(sal_Bool bBulletOnOffMode, sal_Bool bNormalBullet, sal_Bool bMasterView, SvxNumRule* pNumRule, sal_Bool bForceBulletOnOff)
+{
+ SdrModel* pSdrModel = GetModel();
+ Window* pWindow = dynamic_cast< Window* >(GetFirstOutputDevice());
+ if (!pSdrModel || !pWindow)
+ return;
+
+ sal_Bool bUndoEnabled = pSdrModel->IsUndoEnabled();
+ sal_Bool bToggleOn = ShouldToggleOn(bBulletOnOffMode, bNormalBullet);
+ if ( bForceBulletOnOff ) {
+ bToggleOn = bBulletOnOffMode;
+ }
+ SdrUndoGroup* pUndoGroup = new SdrUndoGroup(*pSdrModel);
+ SdrOutliner* pOutliner = SdrMakeOutliner(OUTLINERMODE_TEXTOBJECT, pSdrModel);
+ OutlinerView* pOutlinerView = new OutlinerView(pOutliner, pWindow);
+
+ sal_uInt32 nMarkCount = GetMarkedObjectCount();
+ for (sal_uInt32 nIndex = 0; nIndex < nMarkCount; nIndex++)
+ {
+ SdrTextObj* pTextObj = dynamic_cast< SdrTextObj* >(GetMarkedObjectByIndex(nIndex));
+ if (!pTextObj || pTextObj->IsTextEditActive())
+ continue;
+ if (pTextObj->ISA(SdrTableObj))
+ {
+ SdrTableObj* pTableObj = dynamic_cast< SdrTableObj* >(pTextObj);
+ if (!pTableObj)
+ continue;
+ CellPos aStart, aEnd;
+ SvxTableController* pTableController = dynamic_cast< SvxTableController* >(getSelectionController().get());
+ if (pTableController)
+ {
+ pTableController->getSelectedCells(aStart, aEnd);
+ }
+ else
+ {
+ aStart = pTableObj->getFirstCell();
+ aEnd = pTableObj->getLastCell();
+ }
+ sal_Int32 nColCount = pTableObj->getColumnCount();
+ for (sal_Int32 nRow = aStart.mnRow; nRow <= aEnd.mnRow; nRow++)
+ {
+ for (sal_Int32 nCol = aStart.mnCol; nCol <= aEnd.mnCol; nCol++)
+ {
+ sal_Int32 nIndex = nRow * nColCount + nCol;
+ SdrText* pText = pTableObj->getText(nIndex);
+ if (!pText || !pText->GetOutlinerParaObject())
+ continue;
+
+ pOutliner->SetText(*(pText->GetOutlinerParaObject()));
+ if (bUndoEnabled)
+ {
+ SdrUndoObjSetText* pTxtUndo = dynamic_cast< SdrUndoObjSetText* >(pSdrModel->GetSdrUndoFactory().CreateUndoObjectSetText(*pTextObj, nIndex));
+ pUndoGroup->AddAction(pTxtUndo);
+ }
+ pOutlinerView->ToggleAllParagraphsBullets(bBulletOnOffMode, bNormalBullet, bToggleOn, bMasterView, pNumRule);
+ sal_uInt32 nParaCount = pOutliner->GetParagraphCount();
+ pText->SetOutlinerParaObject(pOutliner->CreateParaObject(0, (sal_uInt16)nParaCount));
+ pOutliner->Clear();
+ }
+ }
+ // Broadcast the object change event.
+ if (!pTextObj->AdjustTextFrameWidthAndHeight())
+ {
+ pTextObj->SetChanged();
+ pTextObj->BroadcastObjectChange();
+ }
+ }
+ else
+ {
+ OutlinerParaObject* pParaObj = pTextObj->GetOutlinerParaObject();
+ if (!pParaObj)
+ continue;
+ pOutliner->SetText(*pParaObj);
+ if (bUndoEnabled)
+ {
+ SdrUndoObjSetText* pTxtUndo = dynamic_cast< SdrUndoObjSetText* >(pSdrModel->GetSdrUndoFactory().CreateUndoObjectSetText(*pTextObj, 0));
+ pUndoGroup->AddAction(pTxtUndo);
+ }
+ pOutlinerView->ToggleAllParagraphsBullets(bBulletOnOffMode, bNormalBullet, bToggleOn, bMasterView, pNumRule);
+ sal_uInt32 nParaCount = pOutliner->GetParagraphCount();
+ pTextObj->SetOutlinerParaObject(pOutliner->CreateParaObject(0, (sal_uInt16)nParaCount));
+ pOutliner->Clear();
+ }
+ }
+
+ if (pUndoGroup->GetActionCount() > 0 && bUndoEnabled)
+ {
+ pSdrModel->BegUndo();
+ pSdrModel->AddUndo(pUndoGroup);
+ pSdrModel->EndUndo();
+ }
+ else
+ {
+ delete pUndoGroup;
+ }
+ delete pOutliner;
+ delete pOutlinerView;
+}
+
} // end of namespace sd
Modified: openoffice/branches/ia2/main/sd/source/ui/view/viewshel.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/ia2/main/sd/source/ui/view/viewshel.cxx?rev=1470868&r1=1470867&r2=1470868&view=diff
==============================================================================
--- openoffice/branches/ia2/main/sd/source/ui/view/viewshel.cxx (original)
+++ openoffice/branches/ia2/main/sd/source/ui/view/viewshel.cxx Tue Apr 23 09:51:15 2013
@@ -91,6 +91,11 @@
#include "Window.hxx"
#include "fupoor.hxx"
+#include <editeng/numitem.hxx>
+#include <editeng/eeitem.hxx>
+#include <svl/poolitem.hxx>
+#include <glob.hrc>
+
#ifndef SO2_DECL_SVINPLACEOBJECT_DEFINED
#define SO2_DECL_SVINPLACEOBJECT_DEFINED
SO2_DECL_REF(SvInPlaceObject)
@@ -174,7 +179,8 @@ ViewShell::~ViewShell()
{
// Keep the content window from accessing in its destructor the
// WindowUpdater.
- mpContentWindow->SetViewShell(NULL);
+ if (mpContentWindow)
+ mpContentWindow->SetViewShell(NULL);
delete mpZoomList;
@@ -183,6 +189,13 @@ ViewShell::~ViewShell()
if (mpImpl->mpSubShellFactory.get() != NULL)
GetViewShellBase().GetViewShellManager()->RemoveSubShellFactory(
this,mpImpl->mpSubShellFactory);
+
+ if (mpContentWindow)
+ {
+ OSL_TRACE("destroying mpContentWindow at %x with parent %x", mpContentWindow.get(),
+ mpContentWindow->GetParent());
+ mpContentWindow.reset();
+ }
}
@@ -794,7 +807,86 @@ void ViewShell::SetupRulers (void)
}
}
+const SfxPoolItem* ViewShell::GetNumBulletItem(SfxItemSet& aNewAttr, sal_uInt16& nNumItemId)
+{
+ const SfxPoolItem* pTmpItem = NULL;
+
+ if(aNewAttr.GetItemState(nNumItemId, sal_False, &pTmpItem) == SFX_ITEM_SET)
+ {
+ return pTmpItem;
+ }
+ else
+ {
+ nNumItemId = aNewAttr.GetPool()->GetWhich(SID_ATTR_NUMBERING_RULE);
+ SfxItemState eState = aNewAttr.GetItemState(nNumItemId, sal_False, &pTmpItem);
+ if (eState == SFX_ITEM_SET)
+ return pTmpItem;
+ else
+ {
+ sal_Bool bOutliner = sal_False;
+ sal_Bool bTitle = sal_False;
+
+ if( mpView )
+ {
+ const SdrMarkList& rMarkList = mpView->GetMarkedObjectList();
+ const sal_uInt32 nCount = rMarkList.GetMarkCount();
+
+ for(sal_uInt32 nNum = 0; nNum < nCount; nNum++)
+ {
+ SdrObject* pObj = rMarkList.GetMark(nNum)->GetMarkedSdrObj();
+ if( pObj->GetObjInventor() == SdrInventor )
+ {
+ switch(pObj->GetObjIdentifier())
+ {
+ case OBJ_TITLETEXT:
+ bTitle = sal_True;
+ break;
+ case OBJ_OUTLINETEXT:
+ bOutliner = sal_True;
+ break;
+ }
+ }
+ }
+ }
+ const SvxNumBulletItem *pItem = NULL;
+ if(bOutliner)
+ {
+ SfxStyleSheetBasePool* pSSPool = mpView->GetDocSh()->GetStyleSheetPool();
+ String aStyleName((SdResId(STR_LAYOUT_OUTLINE)));
+ aStyleName.AppendAscii( RTL_CONSTASCII_STRINGPARAM( " 1" ) );
+ SfxStyleSheetBase* pFirstStyleSheet = pSSPool->Find( aStyleName, SD_STYLE_FAMILY_PSEUDO);
+ if( pFirstStyleSheet )
+ pFirstStyleSheet->GetItemSet().GetItemState(EE_PARA_NUMBULLET, sal_False, (const SfxPoolItem**)&pItem);
+ }
+
+ if( pItem == NULL )
+ pItem = (SvxNumBulletItem*) aNewAttr.GetPool()->GetSecondaryPool()->GetPoolDefaultItem(EE_PARA_NUMBULLET);
+
+ aNewAttr.Put(*pItem, EE_PARA_NUMBULLET);
+
+ if(bTitle && aNewAttr.GetItemState(EE_PARA_NUMBULLET,sal_True) == SFX_ITEM_ON )
+ {
+ SvxNumBulletItem* pItem = (SvxNumBulletItem*)aNewAttr.GetItem(EE_PARA_NUMBULLET,sal_True);
+ SvxNumRule* pRule = pItem->GetNumRule();
+ if(pRule)
+ {
+ SvxNumRule aNewRule( *pRule );
+ aNewRule.SetFeatureFlag( NUM_NO_NUMBERS, sal_True );
+
+ SvxNumBulletItem aNewItem( aNewRule, EE_PARA_NUMBULLET );
+ aNewAttr.Put(aNewItem);
+ }
+ }
+
+ SfxItemState eState = aNewAttr.GetItemState(nNumItemId, sal_False, &pTmpItem);
+ if (eState == SFX_ITEM_SET)
+ return pTmpItem;
+
+ }
+ }
+ return pTmpItem;
+}
sal_Bool ViewShell::HasRuler (void)
@@ -964,9 +1056,10 @@ void ViewShell::ArrangeGUIElements (void
{
OSL_ASSERT (GetViewShell()!=NULL);
- mpContentWindow->SetPosSizePixel(
- Point(nLeft,nTop),
- Size(nRight-nLeft,nBottom-nTop));
+ if (mpContentWindow)
+ mpContentWindow->SetPosSizePixel(
+ Point(nLeft,nTop),
+ Size(nRight-nLeft,nBottom-nTop));
}
// Windows in the center and rulers at the left and top side.
Modified: openoffice/branches/ia2/main/sd/uiconfig/sdraw/menubar/menubar.xml
URL: http://svn.apache.org/viewvc/openoffice/branches/ia2/main/sd/uiconfig/sdraw/menubar/menubar.xml?rev=1470868&r1=1470867&r2=1470868&view=diff
==============================================================================
--- openoffice/branches/ia2/main/sd/uiconfig/sdraw/menubar/menubar.xml (original)
+++ openoffice/branches/ia2/main/sd/uiconfig/sdraw/menubar/menubar.xml Tue Apr 23 09:51:15 2013
@@ -129,6 +129,7 @@
<menu:menuseparator/>
<menu:menuitem menu:id=".uno:Navigator"/>
<menu:menuitem menu:id=".uno:TaskPane"/>
+ <menu:menuitem menu:id=".uno:Sidebar"/>
<menu:menuseparator/>
<menu:menuitem menu:id=".uno:Zoom"/>
</menu:menupopup>
Modified: openoffice/branches/ia2/main/sd/uiconfig/simpress/menubar/menubar.xml
URL: http://svn.apache.org/viewvc/openoffice/branches/ia2/main/sd/uiconfig/simpress/menubar/menubar.xml?rev=1470868&r1=1470867&r2=1470868&view=diff
==============================================================================
--- openoffice/branches/ia2/main/sd/uiconfig/simpress/menubar/menubar.xml (original)
+++ openoffice/branches/ia2/main/sd/uiconfig/simpress/menubar/menubar.xml Tue Apr 23 09:51:15 2013
@@ -120,6 +120,7 @@
</menu:menu>
<menu:menuseparator/>
<menu:menuitem menu:id=".uno:TaskPane"/>
+ <menu:menuitem menu:id=".uno:Sidebar"/>
<menu:menuitem menu:id=".uno:LeftPaneImpress"/>
<menu:menuitem menu:id=".uno:AvailableToolbars"/>
<menu:menuitem menu:id=".uno:StatusBarVisible"/>
@@ -270,6 +271,7 @@
<menu:menuitem menu:id=".uno:Gallery"/>
<menu:menuitem menu:id=".uno:BmpMask"/>
<menu:menuitem menu:id=".uno:AVMediaPlayer"/>
+ <menu:menuitem menu:id=".uno:PresentationMinimizer"/>
<menu:menuseparator/>
<menu:menu menu:id=".uno:MacrosMenu">
<menu:menupopup>
Modified: openoffice/branches/ia2/main/sd/util/makefile.mk
URL: http://svn.apache.org/viewvc/openoffice/branches/ia2/main/sd/util/makefile.mk?rev=1470868&r1=1470867&r2=1470868&view=diff
==============================================================================
--- openoffice/branches/ia2/main/sd/util/makefile.mk (original)
+++ openoffice/branches/ia2/main/sd/util/makefile.mk Tue Apr 23 09:51:15 2013
@@ -125,15 +125,14 @@ LIB3FILES= \
$(SLB)$/controller.lib
LIB5TARGET=$(SLB)$/sdraw3_2.lib
-LIB5FILES= \
- $(SLB)$/html.lib \
- $(SLB)$/filter.lib \
- $(SLB)$/unoidl.lib \
- $(SLB)$/animui.lib \
+LIB5FILES= \
+ $(SLB)$/html.lib \
+ $(SLB)$/filter.lib \
+ $(SLB)$/unoidl.lib \
+ $(SLB)$/animui.lib \
$(SLB)$/accessibility.lib \
- $(SLB)$/toolpanel.lib \
$(SLB)$/uitools.lib \
- $(SLB)$/tpcontrols.lib
+ $(SLB)$/sidebar.lib
LIB6TARGET=$(SLB)$/sdraw3_3.lib
LIB6FILES= \
Modified: openoffice/branches/ia2/main/sd/util/sd.component
URL: http://svn.apache.org/viewvc/openoffice/branches/ia2/main/sd/util/sd.component?rev=1470868&r1=1470867&r2=1470868&view=diff
==============================================================================
--- openoffice/branches/ia2/main/sd/util/sd.component (original)
+++ openoffice/branches/ia2/main/sd/util/sd.component Tue Apr 23 09:51:15 2013
@@ -68,8 +68,8 @@
<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 name="org.openoffice.comp.Draw.framework.PanelFactory">
+ <service name="com.sun.star.drawing.framework.PanelFactory"/>
</implementation>
<implementation name="com.sun.star.comp.Draw.framework.configuration.Configuration">
<service name="com.sun.star.drawing.framework.Configuration"/>
@@ -83,9 +83,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>
Modified: openoffice/branches/ia2/main/sdext/prj/build.lst
URL: http://svn.apache.org/viewvc/openoffice/branches/ia2/main/sdext/prj/build.lst?rev=1470868&r1=1470867&r2=1470868&view=diff
==============================================================================
--- openoffice/branches/ia2/main/sdext/prj/build.lst (original)
+++ openoffice/branches/ia2/main/sdext/prj/build.lst Tue Apr 23 09:51:15 2013
@@ -1,12 +1,8 @@
dx sdext : L10N:l10n offuh comphelper unotools readlicense_oo cppu tools cppuhelper sal javaunohelper officecfg LIBXSLT:libxslt xmlhelp NULL
dx sdext usr1 - all sdext_mkout NULL
dx sdext\prj get - all sdext_prj NULL
-dx sdext\source\minimizer nmake - all sdext_minimizer sdext_minimizer_rdoooe sdext_minimizer_rdooo sdext_inc NULL
-dx sdext\source\minimizer\registry\data\org\openoffice\Office\extension nmake - all sdext_minimizer_rdoooe NULL
-dx sdext\source\minimizer\registry\data\org\openoffice\Office nmake - all sdext_minimizer_rdooo NULL
-dx sdext\source\presenter\registry\data\org\openoffice\Office\extension nmake - all sdext_presenter_xcu NULL
-dx sdext\source\presenter\help\en-US\com.sun.PresenterScreen nmake - all sdext_presenter_help NULL
-dx sdext\source\presenter nmake - all sdext_presenter sdext_inc sdext_presenter_xcu sdext_presenter_help NULL
+dx sdext\source\minimizer nmake - all sdext_minimizer sdext_inc NULL
+dx sdext\source\presenter nmake - all sdext_presenter sdext_inc NULL
dx sdext\inc nmake - all sdext_inc NULL
dx sdext\source\pdfimport\xpdfwrapper nmake - all dx_xpdfwrap NULL
dx sdext\source\pdfimport\xpdftest nmake - all dx_parsetest dx_xpdfwrap NULL
Modified: openoffice/branches/ia2/main/sdext/prj/d.lst
URL: http://svn.apache.org/viewvc/openoffice/branches/ia2/main/sdext/prj/d.lst?rev=1470868&r1=1470867&r2=1470868&view=diff
==============================================================================
--- openoffice/branches/ia2/main/sdext/prj/d.lst (original)
+++ openoffice/branches/ia2/main/sdext/prj/d.lst Tue Apr 23 09:51:15 2013
@@ -1,10 +1,31 @@
-mkdir: %_DEST%\bin%_EXT%\minimizer
-mkdir: %_DEST%\bin%_EXT%\presenter
mkdir: %_DEST%\bin%_EXT%\pdfimport
..\%__SRC%\bin\pdf2xml.* %_DEST%\bin%_EXT%\pdf2xml.*
..\%__SRC%\bin\pdfunzip.* %_DEST%\bin%_EXT%\pdfunzip.*
..\%__SRC%\bin\pdfimport.oxt %_DEST%\bin%_EXT%\pdfimport\pdfimport.oxt
-..\%__SRC%\bin\presentation-minimizer.oxt %_DEST%\bin%_EXT%\minimizer\presentation-minimizer.oxt
-..\%__SRC%\bin\presentation_minimizer_develop.zip %_DEST%\bin%_EXT%\minimizer\presentation_minimizer_develop.zip
-..\%__SRC%\bin\presenter-screen.oxt %_DEST%\bin%_EXT%\presenter\presenter-screen.oxt
-..\%__SRC%\bin\presenter-screen_develop.zip %_DEST%\bin%_EXT%\presenter\presenter-screen_develop.zip
+
+
+
+mkdir: %COMMON_DEST%\res%_EXT%
+..\%__SRC%\bin\*.res %_DEST%\bin%_EXT%\*.res
+
+mkdir: %_DEST%\xml%_EXT%
+mkdir: %_DEST%\xml%_EXT%\registry
+mkdir: %_DEST%\xml%_EXT%\registry\spool
+mkdir: %_DEST%\xml%_EXT%\registry\spool\org
+mkdir: %_DEST%\xml%_EXT%\registry\spool\org\openoffice
+mkdir: %_DEST%\xml%_EXT%\registry\spool\org\openoffice\Office
+mkdir: %_DEST%\xml%_EXT%\registry\spool\org\openoffice\Office\Jobs
+mkdir: %_DEST%\xml%_EXT%\registry\spool\org\openoffice\Office\ProtocolHandler
+
+..\%__SRC%\misc\registry\spool\org\openoffice\Office\Jobs\*.xcu %_DEST%\xml%_EXT%\registry\spool\org\openoffice\Office\Jobs
+..\%__SRC%\misc\registry\spool\org\openoffice\Office\ProtocolHandler\*.xcu %_DEST%\xml%_EXT%\registry\spool\org\openoffice\Office\ProtocolHandler
+
+mkdir: %_DEST%\xml%_EXT%
+..\%__SRC%\misc\PresentationMinimizer.component %_DEST%\xml%_EXT%\PresentationMinimizer.component
+..\%__SRC%\misc\PresenterScreen.component %_DEST%\xml%_EXT%\PresenterScreen.component
+
+..\%__SRC%\bin\PresentationMinimizer*.dll %_DEST%\bin%_EXT%\PresentationMinimizer*.dll
+..\%__SRC%\lib\PresentationMinimizer*.so %_DEST%\lib%_EXT%
+..\%__SRC%\bin\PresenterScreen*.dll %_DEST%\bin%_EXT%\PresenterScreen*.dll
+..\%__SRC%\lib\PresenterScreen*.so %_DEST%\lib%_EXT%
+..\%__SRC%\lib\*.dylib %_DEST%\lib%_EXT%\*.dylib
Modified: openoffice/branches/ia2/main/sdext/source/minimizer/configurationaccess.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/ia2/main/sdext/source/minimizer/configurationaccess.cxx?rev=1470868&r1=1470867&r2=1470868&view=diff
==============================================================================
--- openoffice/branches/ia2/main/sdext/source/minimizer/configurationaccess.cxx (original)
+++ openoffice/branches/ia2/main/sdext/source/minimizer/configurationaccess.cxx Tue Apr 23 09:51:15 2013
@@ -31,13 +31,39 @@
#include <com/sun/star/container/XNameContainer.hpp>
#include <com/sun/star/util/XMacroExpander.hpp>
#include <com/sun/star/lang/XSingleServiceFactory.hpp>
+#include <com/sun/star/resource/XResourceBundleLoader.hpp>
+
+#include <rtl/ustrbuf.hxx>
+
+#include "minimizer.hrc"
-using namespace ::rtl;
using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::container;
+using rtl::OUString;
+using rtl::OUStringBuffer;
+
+
+#include <rtl/instance.hxx>
+
+typedef std::map < sal_Int32, rtl::OUString > StringResourceMap;
+
+struct StaticResourceMap
+ : public rtl::StaticWithInit< StringResourceMap, StaticResourceMap >
+{
+ StringResourceMap &
+ operator()() const;
+};
+
+StringResourceMap &
+StaticResourceMap::operator()() const
+{
+ static StringResourceMap aMap;
+ return aMap;
+}
+
static const OUString& GetConfigurationProviderServiceName (void)
{
static const OUString sConfigurationProviderServiceName (
@@ -48,10 +74,31 @@ static const OUString& GetConfigurationP
static const OUString& GetPathToConfigurationRoot (void)
{
static const OUString sPathToConfigurationRoot (
- RTL_CONSTASCII_USTRINGPARAM("org.openoffice.Office.extension.SunPresentationMinimizer"));
+ RTL_CONSTASCII_USTRINGPARAM("org.openoffice.Office.Impress/PresentationMinimizer"));
return sPathToConfigurationRoot;
}
+static OUString lcl_loadString(
+ const Reference< resource::XResourceBundle > xResourceBundle,
+ sal_Int32 nResourceId )
+{
+ OUString sString;
+ OUStringBuffer sKey;
+ sKey.appendAscii( RTL_CONSTASCII_STRINGPARAM( "string:" ) );
+ sKey.append( nResourceId );
+
+ try
+ {
+ OSL_VERIFY( xResourceBundle->getByName( sKey.makeStringAndClear() ) >>= sString );
+ }
+ catch( const uno::Exception& )
+ {
+ OSL_ENSURE( false, "OptimizerSettings: missing resource!" );
+ }
+
+ return sString;
+}
+
void OptimizerSettings::LoadSettingsFromConfiguration( const Reference< XNameAccess >& rSettings )
{
if ( rSettings.is() )
@@ -159,8 +206,8 @@ sal_Bool OptimizerSettings::operator==(
}
-ConfigurationAccess::ConfigurationAccess( const Reference< uno::XComponentContext >& rxMSF, OptimizerSettings* pDefaultSettings ) :
- mxMSF( rxMSF )
+ConfigurationAccess::ConfigurationAccess( const Reference< uno::XComponentContext >& rxContext, OptimizerSettings* pDefaultSettings ) :
+ m_xContext( rxContext )
{
LoadStrings();
maSettings.push_back( pDefaultSettings ?
@@ -174,66 +221,101 @@ ConfigurationAccess::~ConfigurationAcces
{
}
-rtl::OUString ConfigurationAccess::getPath( const PPPOptimizerTokenEnum eToken )
-{
- rtl::OUString aPath;
- try
- {
- static const OUString sProtocol( RTL_CONSTASCII_USTRINGPARAM( "vnd.sun.star.expand:" ) );
- static const OUString stheMacroExpander( RTL_CONSTASCII_USTRINGPARAM( "/singletons/com.sun.star.util.theMacroExpander" ) );
- Reference< container::XNameAccess > xSet( OpenConfiguration( true ), UNO_QUERY_THROW );
- if ( xSet->hasByName( TKGet( eToken ) ) )
- xSet->getByName( TKGet( eToken ) ) >>= aPath;
- if ( aPath.match( sProtocol, 0 ) )
- {
- rtl::OUString aTmp( aPath.copy( 20 ) );
- Reference< util::XMacroExpander > xExpander;
- if ( mxMSF->getValueByName( stheMacroExpander ) >>= xExpander )
- {
- aPath = xExpander->expandMacros( aTmp );
- }
- }
- }
- catch ( Exception& )
- {
- }
- return aPath;
-}
-
-rtl::OUString ConfigurationAccess::getString( const PPPOptimizerTokenEnum eToken ) const
+rtl::OUString ConfigurationAccess::getString( sal_Int32 nResId )
{
- std::map< PPPOptimizerTokenEnum, rtl::OUString, Compare >::const_iterator aIter( maStrings.find( eToken ) );
- return aIter != maStrings.end() ? ((*aIter).second) : rtl::OUString();
+ const StringResourceMap &aStrings = StaticResourceMap::get();
+ StringResourceMap::const_iterator aIter( aStrings.find( nResId ) );
+ return aIter != aStrings.end() ? ((*aIter).second) : rtl::OUString();
}
void ConfigurationAccess::LoadStrings()
{
+ static bool bLoaded = false;
+ if ( bLoaded )
+ return;
+ else
+ bLoaded = true;
try
{
- do
- {
- Reference< XInterface > xRoot( OpenConfiguration( true ) );
- if ( !xRoot.is() )
- break;
- Reference< container::XNameAccess > xSet( GetConfigurationNode( xRoot, TKGet( TK_Strings ) ), UNO_QUERY );
- if ( xSet.is() )
- {
- const Sequence< OUString > aElements( xSet->getElementNames() );
- for ( int i = 0; i < aElements.getLength(); i++ )
- {
- try
- {
- OUString aString, aPropertyName( aElements[ i ] );
- if ( xSet->getByName( aPropertyName ) >>= aString )
- maStrings[ TKGet( aPropertyName ) ] = aString;
- }
- catch( Exception& )
- {
- }
- }
- }
- }
- while( false );
+
+ Reference< resource::XResourceBundleLoader > xResourceBundleLoader(
+ m_xContext->getValueByName(
+ OUString( RTL_CONSTASCII_USTRINGPARAM(
+ "/singletons/com.sun.star.resource.OfficeResourceLoader" ) ) ),
+ UNO_QUERY_THROW );
+
+ Reference< resource::XResourceBundle > xResourceBundle(
+ xResourceBundleLoader->loadBundle_Default(
+ OUString( RTL_CONSTASCII_USTRINGPARAM( "minimizer" ) ) ),
+ UNO_SET_THROW );
+
+ StringResourceMap &aStrings = StaticResourceMap::get();
+ aStrings[ STR_PRESENTATION_MINIMIZER ] = lcl_loadString( xResourceBundle, STR_PRESENTATION_MINIMIZER );
+ aStrings[ STR_STEPS ] = lcl_loadString( xResourceBundle, STR_STEPS );
+ aStrings[ STR_HELP ] = lcl_loadString( xResourceBundle, STR_HELP );
+ aStrings[ STR_BACK ] = lcl_loadString( xResourceBundle, STR_BACK );
+ aStrings[ STR_NEXT ] = lcl_loadString( xResourceBundle, STR_NEXT );
+ aStrings[ STR_FINISH ] = lcl_loadString( xResourceBundle, STR_FINISH );
+ aStrings[ STR_CANCEL ] = lcl_loadString( xResourceBundle, STR_CANCEL );
+ aStrings[ STR_INTRODUCTION ] = lcl_loadString( xResourceBundle, STR_INTRODUCTION );
+ aStrings[ STR_INTRODUCTION_T ] = lcl_loadString( xResourceBundle, STR_INTRODUCTION_T );
+ aStrings[ STR_CHOSE_SETTINGS ] = lcl_loadString( xResourceBundle, STR_CHOSE_SETTINGS );
+ aStrings[ STR_REMOVE ] = lcl_loadString( xResourceBundle, STR_REMOVE );
+ aStrings[ STR_GRAPHIC_OPTIMIZATION ] = lcl_loadString( xResourceBundle, STR_GRAPHIC_OPTIMIZATION );
+ aStrings[ STR_IMAGE_OPTIMIZATION ] = lcl_loadString( xResourceBundle, STR_IMAGE_OPTIMIZATION );
+ aStrings[ STR_LOSSLESS_COMPRESSION ] = lcl_loadString( xResourceBundle, STR_LOSSLESS_COMPRESSION );
+ aStrings[ STR_JPEG_COMPRESSION ] = lcl_loadString( xResourceBundle, STR_JPEG_COMPRESSION );
+ aStrings[ STR_QUALITY ] = lcl_loadString( xResourceBundle, STR_QUALITY );
+ aStrings[ STR_REMOVE_CROP_AREA ] = lcl_loadString( xResourceBundle, STR_REMOVE_CROP_AREA );
+ aStrings[ STR_IMAGE_RESOLUTION ] = lcl_loadString( xResourceBundle, STR_IMAGE_RESOLUTION );
+ aStrings[ STR_IMAGE_RESOLUTION_0 ] = lcl_loadString( xResourceBundle, STR_IMAGE_RESOLUTION_0 );
+ aStrings[ STR_IMAGE_RESOLUTION_1 ] = lcl_loadString( xResourceBundle, STR_IMAGE_RESOLUTION_1 );
+ aStrings[ STR_IMAGE_RESOLUTION_2 ] = lcl_loadString( xResourceBundle, STR_IMAGE_RESOLUTION_2 );
+ aStrings[ STR_IMAGE_RESOLUTION_3 ] = lcl_loadString( xResourceBundle, STR_IMAGE_RESOLUTION_3 );
+ aStrings[ STR_EMBED_LINKED_GRAPHICS ] = lcl_loadString( xResourceBundle, STR_EMBED_LINKED_GRAPHICS );
+ aStrings[ STR_OLE_OBJECTS ] = lcl_loadString( xResourceBundle, STR_OLE_OBJECTS );
+ aStrings[ STR_OLE_OPTIMIZATION ] = lcl_loadString( xResourceBundle, STR_OLE_OPTIMIZATION );
+ aStrings[ STR_OLE_REPLACE ] = lcl_loadString( xResourceBundle, STR_OLE_REPLACE );
+ aStrings[ STR_ALL_OLE_OBJECTS ] = lcl_loadString( xResourceBundle, STR_ALL_OLE_OBJECTS );
+ aStrings[ STR_ALIEN_OLE_OBJECTS_ONLY ] = lcl_loadString( xResourceBundle, STR_ALIEN_OLE_OBJECTS_ONLY );
+ aStrings[ STR_OLE_OBJECTS_DESC ] = lcl_loadString( xResourceBundle, STR_OLE_OBJECTS_DESC );
+ aStrings[ STR_NO_OLE_OBJECTS_DESC ] = lcl_loadString( xResourceBundle, STR_NO_OLE_OBJECTS_DESC );
+ aStrings[ STR_SLIDES ] = lcl_loadString( xResourceBundle, STR_SLIDES );
+ aStrings[ STR_CHOOSE_SLIDES ] = lcl_loadString( xResourceBundle, STR_CHOOSE_SLIDES );
+ aStrings[ STR_MASTER_PAGES ] = lcl_loadString( xResourceBundle, STR_MASTER_PAGES );
+ aStrings[ STR_DELETE_MASTER_PAGES ] = lcl_loadString( xResourceBundle, STR_DELETE_MASTER_PAGES );
+ aStrings[ STR_DELETE_NOTES_PAGES ] = lcl_loadString( xResourceBundle, STR_DELETE_NOTES_PAGES );
+ aStrings[ STR_DELETE_HIDDEN_SLIDES ] = lcl_loadString( xResourceBundle, STR_DELETE_HIDDEN_SLIDES );
+ aStrings[ STR_CUSTOM_SHOW ] = lcl_loadString( xResourceBundle, STR_CUSTOM_SHOW );
+ aStrings[ STR_SUMMARY ] = lcl_loadString( xResourceBundle, STR_SUMMARY );
+ aStrings[ STR_SUMMARY_TITLE ] = lcl_loadString( xResourceBundle, STR_SUMMARY_TITLE );
+ aStrings[ STR_PROGRESS ] = lcl_loadString( xResourceBundle, STR_PROGRESS );
+ aStrings[ STR_OBJECTS_OPTIMIZED ] = lcl_loadString( xResourceBundle, STR_OBJECTS_OPTIMIZED );
+ aStrings[ STR_APPLY_TO_CURRENT ] = lcl_loadString( xResourceBundle, STR_APPLY_TO_CURRENT );
+ aStrings[ STR_AUTOMATICALLY_OPEN ] = lcl_loadString( xResourceBundle, STR_AUTOMATICALLY_OPEN );
+ aStrings[ STR_SAVE_SETTINGS ] = lcl_loadString( xResourceBundle, STR_SAVE_SETTINGS );
+ aStrings[ STR_SAVE_AS ] = lcl_loadString( xResourceBundle, STR_SAVE_AS );
+ aStrings[ STR_DELETE_SLIDES ] = lcl_loadString( xResourceBundle, STR_DELETE_SLIDES );
+ aStrings[ STR_OPTIMIZE_IMAGES ] = lcl_loadString( xResourceBundle, STR_OPTIMIZE_IMAGES );
+ aStrings[ STR_CREATE_REPLACEMENT ] = lcl_loadString( xResourceBundle, STR_CREATE_REPLACEMENT );
+ aStrings[ STR_CURRENT_FILESIZE ] = lcl_loadString( xResourceBundle, STR_CURRENT_FILESIZE );
+ aStrings[ STR_ESTIMATED_FILESIZE ] = lcl_loadString( xResourceBundle, STR_ESTIMATED_FILESIZE );
+ aStrings[ STR_MB ] = lcl_loadString( xResourceBundle, STR_MB );
+ aStrings[ STR_MY_SETTINGS ] = lcl_loadString( xResourceBundle, STR_MY_SETTINGS );
+ aStrings[ STR_DEFAULT_SESSION ] = lcl_loadString( xResourceBundle, STR_DEFAULT_SESSION );
+ aStrings[ STR_MODIFY_WARNING ] = lcl_loadString( xResourceBundle, STR_MODIFY_WARNING );
+ aStrings[ STR_YES ] = lcl_loadString( xResourceBundle, STR_YES );
+ aStrings[ STR_OK ] = lcl_loadString( xResourceBundle, STR_OK );
+ aStrings[ STR_INFO_1 ] = lcl_loadString( xResourceBundle, STR_INFO_1 );
+ aStrings[ STR_INFO_2 ] = lcl_loadString( xResourceBundle, STR_INFO_2 );
+ aStrings[ STR_INFO_3 ] = lcl_loadString( xResourceBundle, STR_INFO_3 );
+ aStrings[ STR_INFO_4 ] = lcl_loadString( xResourceBundle, STR_INFO_4 );
+ aStrings[ STR_DUPLICATING_PRESENTATION ] = lcl_loadString( xResourceBundle, STR_DUPLICATING_PRESENTATION );
+ aStrings[ STR_DELETING_SLIDES ] = lcl_loadString( xResourceBundle, STR_DELETING_SLIDES );
+ aStrings[ STR_OPTIMIZING_GRAPHICS ] = lcl_loadString( xResourceBundle, STR_OPTIMIZING_GRAPHICS );
+ aStrings[ STR_CREATING_OLE_REPLACEMENTS] = lcl_loadString( xResourceBundle, STR_CREATING_OLE_REPLACEMENTS );
+ aStrings[ STR_FILESIZESEPARATOR ] = lcl_loadString( xResourceBundle, STR_FILESIZESEPARATOR );
+ aStrings[ STR_INFO_DIALOG ] = lcl_loadString( xResourceBundle, STR_INFO_DIALOG );
}
catch( Exception& )
{
@@ -334,7 +416,7 @@ Reference< XInterface > ConfigurationAcc
Reference< XInterface > xRoot;
try
{
- Reference< lang::XMultiServiceFactory > xProvider( mxMSF->getServiceManager()->createInstanceWithContext( GetConfigurationProviderServiceName(), mxMSF ), UNO_QUERY );
+ Reference< lang::XMultiServiceFactory > xProvider( m_xContext->getServiceManager()->createInstanceWithContext( GetConfigurationProviderServiceName(), m_xContext ), UNO_QUERY );
if ( xProvider.is() )
{
Sequence< Any > aCreationArguments( 2 );
Modified: openoffice/branches/ia2/main/sdext/source/minimizer/configurationaccess.hxx
URL: http://svn.apache.org/viewvc/openoffice/branches/ia2/main/sdext/source/minimizer/configurationaccess.hxx?rev=1470868&r1=1470867&r2=1470868&view=diff
==============================================================================
--- openoffice/branches/ia2/main/sdext/source/minimizer/configurationaccess.hxx (original)
+++ openoffice/branches/ia2/main/sdext/source/minimizer/configurationaccess.hxx Tue Apr 23 09:51:15 2013
@@ -40,6 +40,7 @@
#include <com/sun/star/container/XNameReplace.hpp>
#include <map>
+
struct OptimizerSettings
{
rtl::OUString maName;
@@ -86,13 +87,12 @@ class ConfigurationAccess
{
public :
- ConfigurationAccess( const com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >& rXFactory,
+ ConfigurationAccess( const com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >& rxContext,
OptimizerSettings* pDefaultSettings = NULL );
~ConfigurationAccess();
void SaveConfiguration();
- rtl::OUString getPath( const PPPOptimizerTokenEnum );
- rtl::OUString getString( const PPPOptimizerTokenEnum ) const;
+ static rtl::OUString getString( sal_Int32 nResId );
// access to current OptimizerSettings (stored in the first entry of maSettings)
com::sun::star::uno::Any GetConfigProperty( const PPPOptimizerTokenEnum ) const;
@@ -110,20 +110,10 @@ class ConfigurationAccess
private :
- struct Compare
- {
- bool operator()( const PPPOptimizerTokenEnum s1, const PPPOptimizerTokenEnum s2 ) const
- {
- return s1 < s2;
- }
- };
- std::map < PPPOptimizerTokenEnum, rtl::OUString, Compare > maStrings;
-
+ com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext > m_xContext;
std::vector< OptimizerSettings > maSettings;
std::vector< OptimizerSettings > maInitialSettings;
- com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext > mxMSF;
-
void LoadStrings();
void LoadConfiguration();
com::sun::star::uno::Reference< com::sun::star::uno::XInterface > OpenConfiguration( bool bReadOnly );
Modified: openoffice/branches/ia2/main/sdext/source/minimizer/fileopendialog.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/ia2/main/sdext/source/minimizer/fileopendialog.cxx?rev=1470868&r1=1470867&r2=1470868&view=diff
==============================================================================
--- openoffice/branches/ia2/main/sdext/source/minimizer/fileopendialog.cxx (original)
+++ openoffice/branches/ia2/main/sdext/source/minimizer/fileopendialog.cxx Tue Apr 23 09:51:15 2013
@@ -55,8 +55,8 @@
#include <com/sun/star/view/XControlAccess.hpp>
#include <com/sun/star/ucb/InteractiveAugmentedIOException.hpp>
+#include <rtl/ustrbuf.hxx>
-using namespace ::rtl;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::beans;
@@ -64,14 +64,53 @@ using namespace ::com::sun::star::contai
using namespace ::com::sun::star::view;
using namespace ::com::sun::star::ui::dialogs;
-FileOpenDialog::FileOpenDialog( const Reference< XComponentContext >& rxMSF ) :
- mxMSF( rxMSF )
+using ::com::sun::star::awt::XWindow;
+using ::rtl::OUString;
+
+namespace
{
- Sequence< Any > aInitPropSeq( 1 );
- aInitPropSeq[ 0 ] <<= (sal_Int16)TemplateDescription::FILESAVE_AUTOEXTENSION; // TemplateDescription.FILEOPEN_SIMPLE
+ inline bool lcl_isSystemDialog(
+ const Reference< XInterface > &rxIfce )
+ {
+ Reference< XServiceInfo > xInfo( rxIfce, UNO_QUERY );
+ if ( !xInfo.is() )
+ return false;
+
+ return xInfo->supportsService(
+ OUString( RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.ui.dialogs.SystemFilePicker" ) ) );
+ }
+}
+
+FileOpenDialog::FileOpenDialog(
+ const Reference< XComponentContext >& rxContext,
+ const Reference< XWindow > &rxParent )
+ : mxContext( rxContext )
+{
+ mxFilePicker = Reference < XFilePicker >(
+ mxContext->getServiceManager()->createInstanceWithContext(
+ OUString( RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.ui.dialogs.FilePicker" ) ),
+ rxContext ), UNO_QUERY_THROW );
+ Reference< XInitialization > xInit( mxFilePicker, UNO_QUERY_THROW );
+ bool bIsSystemDlg = lcl_isSystemDialog( mxFilePicker );
+ Sequence< Any > aInitPropSeq( bIsSystemDlg ? 1 : 2 );
+ if ( bIsSystemDlg )
+ {
+ aInitPropSeq[0] <<= TemplateDescription::FILESAVE_AUTOEXTENSION;
+ xInit->initialize( aInitPropSeq );
+ }
+ else
+ {
+ aInitPropSeq[ 0 ] <<= NamedValue(
+ OUString(RTL_CONSTASCII_USTRINGPARAM("TemplateDescription")),
+ makeAny( (sal_Int16)TemplateDescription::FILESAVE_AUTOEXTENSION));
+ aInitPropSeq[ 1 ] <<= NamedValue(
+ OUString(RTL_CONSTASCII_USTRINGPARAM("ParentWindow")),
+ makeAny( rxParent ));
+ xInit->initialize( aInitPropSeq );
+ }
- mxFilePicker = Reference < XFilePicker >( mxMSF->getServiceManager()->createInstanceWithArgumentsAndContext(
- OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.ui.dialogs.FilePicker" ) ), aInitPropSeq, rxMSF ),UNO_QUERY_THROW );
mxFilePicker->setMultiSelectionMode( sal_False );
Reference< XFilePickerControlAccess > xAccess( mxFilePicker, UNO_QUERY );
@@ -87,8 +126,8 @@ FileOpenDialog::FileOpenDialog( const Re
}
// collecting a list of impress filters
- Reference< XNameAccess > xFilters( mxMSF->getServiceManager()->createInstanceWithContext(
- OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.document.FilterFactory" ) ), rxMSF ), UNO_QUERY_THROW );
+ Reference< XNameAccess > xFilters( mxContext->getServiceManager()->createInstanceWithContext(
+ OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.document.FilterFactory" ) ), rxContext ), UNO_QUERY_THROW );
Sequence< OUString > aFilterList( xFilters->getElementNames() );
for ( int i = 0; i < aFilterList.getLength(); i++ )
{
@@ -132,12 +171,19 @@ FileOpenDialog::FileOpenDialog( const Re
}
}
- Reference< XNameAccess > xTypes( mxMSF->getServiceManager()->createInstanceWithContext(
- OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.document.TypeDetection" ) ), rxMSF ), UNO_QUERY_THROW );
+ Reference< XNameAccess > xTypes( mxContext->getServiceManager()->createInstanceWithContext(
+ OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.document.TypeDetection" ) ), rxContext ), UNO_QUERY_THROW );
Sequence< OUString > aTypeList( xFilters->getElementNames() );
// mxFilePicker->setDefaultName( );
+ const char filter[] = "*.";
+ // the filter title must be formed in the same way it is currently done
+ // in the internal implementation: "UIName (.<extension>)"
+ rtl::OUStringBuffer aUIName;
+ // the filter must be in the form "*.<extension>"
+ rtl::OUStringBuffer aFilter;
+ rtl::OUString aExtension;
Reference< XFilterManager > xFilterManager( mxFilePicker, UNO_QUERY_THROW );
std::vector< FilterEntry >::iterator aIter( aFilterEntryList.begin() );
while( aIter != aFilterEntryList.end() )
@@ -158,7 +204,18 @@ FileOpenDialog::FileOpenDialog( const Re
}
if ( aExtensions.getLength() )
{
- xFilterManager->appendFilter( aIter->maUIName, aExtensions[ 0 ] );
+ aExtension = aExtensions[0];
+ // form the title: "<UIName> (.<extension)"
+ aUIName.append( aIter->maUIName );
+ aUIName.appendAscii( RTL_CONSTASCII_STRINGPARAM( " (." ));
+ aUIName.append( aExtension );
+ aUIName.append( sal_Unicode( ')' ) );
+ // form the filter: "(*.<extension>)"
+ aFilter.appendAscii( RTL_CONSTASCII_STRINGPARAM( filter ) );
+ aFilter.append( aExtensions[0] );
+
+ xFilterManager->appendFilter( aUIName.makeStringAndClear(),
+ aFilter.makeStringAndClear() );
if ( aIter->maFlags & 0x100 )
xFilterManager->setCurrentFilter( aIter->maUIName );
}
Modified: openoffice/branches/ia2/main/sdext/source/minimizer/fileopendialog.hxx
URL: http://svn.apache.org/viewvc/openoffice/branches/ia2/main/sdext/source/minimizer/fileopendialog.hxx?rev=1470868&r1=1470867&r2=1470868&view=diff
==============================================================================
--- openoffice/branches/ia2/main/sdext/source/minimizer/fileopendialog.hxx (original)
+++ openoffice/branches/ia2/main/sdext/source/minimizer/fileopendialog.hxx Tue Apr 23 09:51:15 2013
@@ -30,6 +30,7 @@
#include <com/sun/star/container/XNameAccess.hpp>
#include <com/sun/star/ui/dialogs/XFilePicker.hpp>
#include <com/sun/star/uno/XComponentContext.hpp>
+#include <com/sun/star/awt/XWindow.hpp>
class FileOpenDialog
{
@@ -46,13 +47,14 @@ class FileOpenDialog
FilterEntry() :
maFlags( 0 ) {}
};
- com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext > mxMSF;
+ com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext > mxContext;
com::sun::star::uno::Reference < ::com::sun::star::ui::dialogs::XFilePicker > mxFilePicker;
std::vector< FilterEntry > aFilterEntryList;
public :
- FileOpenDialog( const com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >& rxMSF );
+ FileOpenDialog( const com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >& rxContext,
+ const com::sun::star::uno::Reference< com::sun::star::awt::XWindow > &rxParent );
~FileOpenDialog();
sal_Int16 execute();
Modified: openoffice/branches/ia2/main/sdext/source/minimizer/graphiccollector.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/ia2/main/sdext/source/minimizer/graphiccollector.cxx?rev=1470868&r1=1470867&r2=1470868&view=diff
==============================================================================
--- openoffice/branches/ia2/main/sdext/source/minimizer/graphiccollector.cxx (original)
+++ openoffice/branches/ia2/main/sdext/source/minimizer/graphiccollector.cxx Tue Apr 23 09:51:15 2013
@@ -35,7 +35,6 @@
#include "impoptimizer.hxx"
-using namespace ::rtl;
using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::awt;
@@ -45,6 +44,8 @@ using namespace ::com::sun::star::frame;
using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::presentation;
+using ::rtl::OUString;
+
const DeviceInfo& GraphicCollector::GetDeviceInfo( const Reference< XComponentContext >& rxFact )
{
static DeviceInfo aDeviceInfo;
@@ -95,7 +96,7 @@ void ImpAddEntity( std::vector< GraphicC
}
}
-void ImpAddGraphicEntity( const Reference< XComponentContext >& rxMSF, Reference< XShape >& rxShape, const GraphicSettings& rGraphicSettings, std::vector< GraphicCollector::GraphicEntity >& rGraphicEntities )
+void ImpAddGraphicEntity( const Reference< XComponentContext >& rxContext, Reference< XShape >& rxShape, const GraphicSettings& rGraphicSettings, std::vector< GraphicCollector::GraphicEntity >& rGraphicEntities )
{
Reference< XGraphic > xGraphic;
Reference< XPropertySet > xShapePropertySet( rxShape, UNO_QUERY_THROW );
@@ -114,7 +115,7 @@ void ImpAddGraphicEntity( const Referenc
// calculating the logical size, as if there were no cropping
if ( aGraphicCropLogic.Left || aGraphicCropLogic.Right || aGraphicCropLogic.Top || aGraphicCropLogic.Bottom )
{
- awt::Size aSize100thMM( GraphicCollector::GetOriginalSize( rxMSF, xGraphic ) );
+ awt::Size aSize100thMM( GraphicCollector::GetOriginalSize( rxContext, xGraphic ) );
if ( aSize100thMM.Width && aSize100thMM.Height )
{
awt::Size aCropSize( aSize100thMM.Width - ( aGraphicCropLogic.Left + aGraphicCropLogic.Right ),
@@ -133,7 +134,7 @@ void ImpAddGraphicEntity( const Referenc
}
}
-void ImpAddFillBitmapEntity( const Reference< XComponentContext >& rxMSF, const Reference< XPropertySet >& rxPropertySet, const awt::Size& rLogicalSize,
+void ImpAddFillBitmapEntity( const Reference< XComponentContext >& rxContext, const Reference< XPropertySet >& rxPropertySet, const awt::Size& rLogicalSize,
std::vector< GraphicCollector::GraphicEntity >& rGraphicEntities, const GraphicSettings& rGraphicSettings, const Reference< XPropertySet >& rxPagePropertySet )
{
try
@@ -171,7 +172,7 @@ void ImpAddFillBitmapEntity( const Refer
{
if ( !aSize.Width || !aSize.Height )
{
- awt::Size aSize100thMM( GraphicCollector::GetOriginalSize( rxMSF, xGraphic ) );
+ awt::Size aSize100thMM( GraphicCollector::GetOriginalSize( rxContext, xGraphic ) );
if ( aSize100thMM.Width && aSize100thMM.Height )
aLogicalSize = aSize100thMM;
}
@@ -205,7 +206,7 @@ void ImpAddFillBitmapEntity( const Refer
}
}
-void ImpCollectBackgroundGraphic( const Reference< XComponentContext >& rxMSF, const Reference< XDrawPage >& rxDrawPage, const GraphicSettings& rGraphicSettings, std::vector< GraphicCollector::GraphicEntity >& rGraphicEntities )
+void ImpCollectBackgroundGraphic( const Reference< XComponentContext >& rxContext, const Reference< XDrawPage >& rxDrawPage, const GraphicSettings& rGraphicSettings, std::vector< GraphicCollector::GraphicEntity >& rGraphicEntities )
{
try
{
@@ -216,14 +217,14 @@ void ImpCollectBackgroundGraphic( const
Reference< XPropertySet > xBackgroundPropSet;
if ( xPropertySet->getPropertyValue( TKGet( TK_Background ) ) >>= xBackgroundPropSet )
- ImpAddFillBitmapEntity( rxMSF, xBackgroundPropSet, aLogicalSize, rGraphicEntities, rGraphicSettings, xPropertySet );
+ ImpAddFillBitmapEntity( rxContext, xBackgroundPropSet, aLogicalSize, rGraphicEntities, rGraphicSettings, xPropertySet );
}
catch( Exception& )
{
}
}
-void ImpCollectGraphicObjects( const Reference< XComponentContext >& rxMSF, const Reference< XShapes >& rxShapes, const GraphicSettings& rGraphicSettings, std::vector< GraphicCollector::GraphicEntity >& rGraphicEntities )
+void ImpCollectGraphicObjects( const Reference< XComponentContext >& rxContext, const Reference< XShapes >& rxShapes, const GraphicSettings& rGraphicSettings, std::vector< GraphicCollector::GraphicEntity >& rGraphicEntities )
{
for ( sal_Int32 i = 0; i < rxShapes->getCount(); i++ )
{
@@ -236,18 +237,18 @@ void ImpCollectGraphicObjects( const Ref
if ( sShapeType == sGroupShape )
{
Reference< XShapes > xShapes( xShape, UNO_QUERY_THROW );
- ImpCollectGraphicObjects( rxMSF, xShapes, rGraphicSettings, rGraphicEntities );
+ ImpCollectGraphicObjects( rxContext, xShapes, rGraphicSettings, rGraphicEntities );
continue;
}
if ( sShapeType == sGraphicObjectShape )
- ImpAddGraphicEntity( rxMSF, xShape, rGraphicSettings, rGraphicEntities );
+ ImpAddGraphicEntity( rxContext, xShape, rGraphicSettings, rGraphicEntities );
// now check for a fillstyle
Reference< XPropertySet > xEmptyPagePropSet;
Reference< XPropertySet > xShapePropertySet( xShape, UNO_QUERY_THROW );
awt::Size aLogicalSize( xShape->getSize() );
- ImpAddFillBitmapEntity( rxMSF, xShapePropertySet, aLogicalSize, rGraphicEntities, rGraphicSettings, xEmptyPagePropSet );
+ ImpAddFillBitmapEntity( rxContext, xShapePropertySet, aLogicalSize, rGraphicEntities, rGraphicSettings, xEmptyPagePropSet );
}
catch( Exception& )
{
@@ -255,7 +256,7 @@ void ImpCollectGraphicObjects( const Ref
}
}
-awt::Size GraphicCollector::GetOriginalSize( const Reference< XComponentContext >& rxMSF, const Reference< XGraphic >& rxGraphic )
+awt::Size GraphicCollector::GetOriginalSize( const Reference< XComponentContext >& rxContext, const Reference< XGraphic >& rxGraphic )
{
awt::Size aSize100thMM( 0, 0 );
Reference< XPropertySet > xGraphicPropertySet( rxGraphic, UNO_QUERY_THROW );
@@ -266,7 +267,7 @@ awt::Size GraphicCollector::GetOriginalS
awt::Size aSourceSizePixel( 0, 0 );
if ( xGraphicPropertySet->getPropertyValue( TKGet( TK_SizePixel ) ) >>= aSourceSizePixel )
{
- const DeviceInfo& rDeviceInfo( GraphicCollector::GetDeviceInfo( rxMSF ) );
+ const DeviceInfo& rDeviceInfo( GraphicCollector::GetDeviceInfo( rxContext ) );
if ( rDeviceInfo.PixelPerMeterX && rDeviceInfo.PixelPerMeterY )
{
aSize100thMM.Width = static_cast< sal_Int32 >( ( aSourceSizePixel.Width * 100000.0 ) / rDeviceInfo.PixelPerMeterX );
@@ -278,7 +279,7 @@ awt::Size GraphicCollector::GetOriginalS
return aSize100thMM;
}
-void GraphicCollector::CollectGraphics( const Reference< XComponentContext >& rxMSF, const Reference< XModel >& rxModel,
+void GraphicCollector::CollectGraphics( const Reference< XComponentContext >& rxContext, const Reference< XModel >& rxModel,
const GraphicSettings& rGraphicSettings, std::vector< GraphicCollector::GraphicEntity >& rGraphicList )
{
try
@@ -289,24 +290,24 @@ void GraphicCollector::CollectGraphics(
for ( i = 0; i < xDrawPages->getCount(); i++ )
{
Reference< XDrawPage > xDrawPage( xDrawPages->getByIndex( i ), UNO_QUERY_THROW );
- ImpCollectBackgroundGraphic( rxMSF, xDrawPage, rGraphicSettings, rGraphicList );
+ ImpCollectBackgroundGraphic( rxContext, xDrawPage, rGraphicSettings, rGraphicList );
Reference< XShapes > xDrawShapes( xDrawPage, UNO_QUERY_THROW );
- ImpCollectGraphicObjects( rxMSF, xDrawShapes, rGraphicSettings, rGraphicList );
+ ImpCollectGraphicObjects( rxContext, xDrawShapes, rGraphicSettings, rGraphicList );
Reference< XPresentationPage > xPresentationPage( xDrawPage, UNO_QUERY_THROW );
Reference< XDrawPage > xNotesPage( xPresentationPage->getNotesPage() );
- ImpCollectBackgroundGraphic( rxMSF, xNotesPage, rGraphicSettings, rGraphicList );
+ ImpCollectBackgroundGraphic( rxContext, xNotesPage, rGraphicSettings, rGraphicList );
Reference< XShapes > xNotesShapes( xNotesPage, UNO_QUERY_THROW );
- ImpCollectGraphicObjects( rxMSF, xNotesShapes, rGraphicSettings, rGraphicList );
+ ImpCollectGraphicObjects( rxContext, xNotesShapes, rGraphicSettings, rGraphicList );
}
Reference< XMasterPagesSupplier > xMasterPagesSupplier( rxModel, UNO_QUERY_THROW );
Reference< XDrawPages > xMasterPages( xMasterPagesSupplier->getMasterPages(), UNO_QUERY_THROW );
for ( i = 0; i < xMasterPages->getCount(); i++ )
{
Reference< XDrawPage > xMasterPage( xMasterPages->getByIndex( i ), UNO_QUERY_THROW );
- ImpCollectBackgroundGraphic( rxMSF, xMasterPage, rGraphicSettings, rGraphicList );
+ ImpCollectBackgroundGraphic( rxContext, xMasterPage, rGraphicSettings, rGraphicList );
Reference< XShapes > xMasterPageShapes( xMasterPage, UNO_QUERY_THROW );
- ImpCollectGraphicObjects( rxMSF, xMasterPageShapes, rGraphicSettings, rGraphicList );
+ ImpCollectGraphicObjects( rxContext, xMasterPageShapes, rGraphicSettings, rGraphicList );
}
std::vector< GraphicCollector::GraphicEntity >::iterator aGraphicIter( rGraphicList.begin() );
@@ -348,7 +349,7 @@ void GraphicCollector::CollectGraphics(
}
}
-void ImpCountGraphicObjects( const Reference< XComponentContext >& rxMSF, const Reference< XShapes >& rxShapes, const GraphicSettings& rGraphicSettings, sal_Int32& rnGraphics )
+void ImpCountGraphicObjects( const Reference< XComponentContext >& rxContext, const Reference< XShapes >& rxShapes, const GraphicSettings& rGraphicSettings, sal_Int32& rnGraphics )
{
for ( sal_Int32 i = 0; i < rxShapes->getCount(); i++ )
{
@@ -361,7 +362,7 @@ void ImpCountGraphicObjects( const Refer
if ( sShapeType == sGroupShape )
{
Reference< XShapes > xShapes( xShape, UNO_QUERY_THROW );
- ImpCountGraphicObjects( rxMSF, xShapes, rGraphicSettings, rnGraphics );
+ ImpCountGraphicObjects( rxContext, xShapes, rGraphicSettings, rnGraphics );
continue;
}
@@ -390,7 +391,7 @@ void ImpCountGraphicObjects( const Refer
}
}
-void ImpCountBackgroundGraphic( const Reference< XComponentContext >& /* rxMSF */, const Reference< XDrawPage >& rxDrawPage,
+void ImpCountBackgroundGraphic( const Reference< XComponentContext >& /* rxContext */, const Reference< XDrawPage >& rxDrawPage,
const GraphicSettings& /* rGraphicSettings */, sal_Int32& rnGraphics )
{
try
@@ -418,7 +419,7 @@ void ImpCountBackgroundGraphic( const Re
}
}
-void GraphicCollector::CountGraphics( const Reference< XComponentContext >& rxMSF, const Reference< XModel >& rxModel,
+void GraphicCollector::CountGraphics( const Reference< XComponentContext >& rxContext, const Reference< XModel >& rxModel,
const GraphicSettings& rGraphicSettings, sal_Int32& rnGraphics )
{
try
@@ -429,24 +430,24 @@ void GraphicCollector::CountGraphics( co
for ( i = 0; i < xDrawPages->getCount(); i++ )
{
Reference< XDrawPage > xDrawPage( xDrawPages->getByIndex( i ), UNO_QUERY_THROW );
- ImpCountBackgroundGraphic( rxMSF, xDrawPage, rGraphicSettings, rnGraphics );
+ ImpCountBackgroundGraphic( rxContext, xDrawPage, rGraphicSettings, rnGraphics );
Reference< XShapes > xDrawShapes( xDrawPage, UNO_QUERY_THROW );
- ImpCountGraphicObjects( rxMSF, xDrawShapes, rGraphicSettings, rnGraphics );
+ ImpCountGraphicObjects( rxContext, xDrawShapes, rGraphicSettings, rnGraphics );
Reference< XPresentationPage > xPresentationPage( xDrawPage, UNO_QUERY_THROW );
Reference< XDrawPage > xNotesPage( xPresentationPage->getNotesPage() );
- ImpCountBackgroundGraphic( rxMSF, xNotesPage, rGraphicSettings, rnGraphics );
+ ImpCountBackgroundGraphic( rxContext, xNotesPage, rGraphicSettings, rnGraphics );
Reference< XShapes > xNotesShapes( xNotesPage, UNO_QUERY_THROW );
- ImpCountGraphicObjects( rxMSF, xNotesShapes, rGraphicSettings, rnGraphics );
+ ImpCountGraphicObjects( rxContext, xNotesShapes, rGraphicSettings, rnGraphics );
}
Reference< XMasterPagesSupplier > xMasterPagesSupplier( rxModel, UNO_QUERY_THROW );
Reference< XDrawPages > xMasterPages( xMasterPagesSupplier->getMasterPages(), UNO_QUERY_THROW );
for ( i = 0; i < xMasterPages->getCount(); i++ )
{
Reference< XDrawPage > xMasterPage( xMasterPages->getByIndex( i ), UNO_QUERY_THROW );
- ImpCountBackgroundGraphic( rxMSF, xMasterPage, rGraphicSettings, rnGraphics );
+ ImpCountBackgroundGraphic( rxContext, xMasterPage, rGraphicSettings, rnGraphics );
Reference< XShapes > xMasterPageShapes( xMasterPage, UNO_QUERY_THROW );
- ImpCountGraphicObjects( rxMSF, xMasterPageShapes, rGraphicSettings, rnGraphics );
+ ImpCountGraphicObjects( rxContext, xMasterPageShapes, rGraphicSettings, rnGraphics );
}
}
catch ( Exception& )
Modified: openoffice/branches/ia2/main/sdext/source/minimizer/graphiccollector.hxx
URL: http://svn.apache.org/viewvc/openoffice/branches/ia2/main/sdext/source/minimizer/graphiccollector.hxx?rev=1470868&r1=1470867&r2=1470868&view=diff
==============================================================================
--- openoffice/branches/ia2/main/sdext/source/minimizer/graphiccollector.hxx (original)
+++ openoffice/branches/ia2/main/sdext/source/minimizer/graphiccollector.hxx Tue Apr 23 09:51:15 2013
@@ -82,14 +82,14 @@ class GraphicCollector
};
static const com::sun::star::awt::DeviceInfo& GetDeviceInfo( const com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >& rxFact );
- static com::sun::star::awt::Size GetOriginalSize( const com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >& rxMSF,
+ static com::sun::star::awt::Size GetOriginalSize( const com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >& rxContext,
const com::sun::star::uno::Reference< com::sun::star::graphic::XGraphic >& rxGraphic );
// collecting graphic instances, the downside of this method is that every graphic is swapped in
- static void CollectGraphics( const com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >& rxMSF, const com::sun::star::uno::Reference< com::sun::star::frame::XModel >& rxModel,
+ static void CollectGraphics( const com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >& rxContext, const com::sun::star::uno::Reference< com::sun::star::frame::XModel >& rxModel,
const GraphicSettings& rGraphicSettings, std::vector< GraphicEntity >& io_rGraphicList );
// counting graphics without swapping in graphics
- static void CountGraphics( const com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >& rxMSF, const com::sun::star::uno::Reference< com::sun::star::frame::XModel >& rxModel,
+ static void CountGraphics( const com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >& rxContext, const com::sun::star::uno::Reference< com::sun::star::frame::XModel >& rxModel,
const GraphicSettings& rGraphicSettings, sal_Int32& rGraphics );
};
Modified: openoffice/branches/ia2/main/sdext/source/minimizer/impoptimizer.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/ia2/main/sdext/source/minimizer/impoptimizer.cxx?rev=1470868&r1=1470867&r2=1470868&view=diff
==============================================================================
--- openoffice/branches/ia2/main/sdext/source/minimizer/impoptimizer.cxx (original)
+++ openoffice/branches/ia2/main/sdext/source/minimizer/impoptimizer.cxx Tue Apr 23 09:51:15 2013
@@ -30,8 +30,8 @@
#include "pagecollector.hxx"
#include "informationdialog.hxx"
-#include <unotools/localfilehelper.hxx>
-#include <unotools/processfactory.hxx>
+#include "minimizer.hrc"
+
#include <vector>
#include "com/sun/star/util/URL.hpp"
#include "com/sun/star/util/XURLTransformer.hpp"
@@ -43,12 +43,9 @@
#include <com/sun/star/frame/XDesktop.hpp>
#include <com/sun/star/awt/XWindow.hpp>
#include <com/sun/star/frame/XStorable.hpp>
-#ifndef _COM_SUN_STAR_FRAME_FrameSearchFlag_HPP_
#include <com/sun/star/frame/FrameSearchFlag.hpp>
-#endif
#include <com/sun/star/frame/XDispatchProvider.hpp>
#include <com/sun/star/graphic/XGraphicProvider.hpp>
-#include <unotools/configmgr.hxx>
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/container/XNamed.hpp>
#include <com/sun/star/drawing/XShapes.hpp>
@@ -61,9 +58,7 @@
#include <com/sun/star/presentation/XPresentationPage.hpp>
#include <com/sun/star/document/XFilter.hpp>
#include <com/sun/star/document/XExporter.hpp>
-#ifndef _COM_SUN_STAR_UNO_RUNTIME_EXCEPTION_HPP_
#include <com/sun/star/uno/RuntimeException.hpp>
-#endif
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/graphic/XGraphicProvider.hpp>
#include <com/sun/star/graphic/GraphicType.hpp>
@@ -73,7 +68,6 @@
#include <com/sun/star/util/URL.hpp>
using namespace ::std;
-using namespace ::rtl;
using namespace ::com::sun::star;
using namespace ::com::sun::star::io;
using namespace ::com::sun::star::awt;
@@ -88,6 +82,8 @@ using namespace ::com::sun::star::docume
using namespace ::com::sun::star::container;
using namespace ::com::sun::star::presentation;
+using ::rtl::OUString;
+
void ImpExtractCustomShow( const Reference< XModel >& rxModel, const OUString& rCustomShowName )
{
vector< Reference< XDrawPage > > vNonUsedPageList;
@@ -266,7 +262,7 @@ void ImpCompressGraphic( Reference< XGra
}
}
-Reference< XGraphic > ImpCompressGraphic( const Reference< XComponentContext >& rxMSF,
+Reference< XGraphic > ImpCompressGraphic( const Reference< XComponentContext >& rxContext,
const Reference< XGraphic >& xGraphic, const awt::Size& aLogicalSize, const text::GraphicCrop& aGraphicCropLogic,
const GraphicSettings& rGraphicSettings )
{
@@ -301,7 +297,7 @@ Reference< XGraphic > ImpCompressGraphic
// cropping has to be removed from SourceSizePixel
if ( aGraphicCropLogic.Left || aGraphicCropLogic.Top || aGraphicCropLogic.Right || aGraphicCropLogic.Bottom )
{
- const awt::Size aSize100thMM( GraphicCollector::GetOriginalSize( rxMSF, xGraphic ) );
+ const awt::Size aSize100thMM( GraphicCollector::GetOriginalSize( rxContext, xGraphic ) );
if ( bRemoveCropArea )
bNeedsOptimizing = sal_True;
@@ -350,9 +346,9 @@ Reference< XGraphic > ImpCompressGraphic
}
if ( bNeedsOptimizing && aDestSizePixel.Width && aDestSizePixel.Height )
{
- Reference< XStream > xTempFile( rxMSF->getServiceManager()->createInstanceWithContext( OUString::createFromAscii( "com.sun.star.io.TempFile" ), rxMSF ), UNO_QUERY_THROW );
+ Reference< XStream > xTempFile( rxContext->getServiceManager()->createInstanceWithContext( OUString::createFromAscii( "com.sun.star.io.TempFile" ), rxContext ), UNO_QUERY_THROW );
Reference< XOutputStream > xOutputStream( xTempFile->getOutputStream() );
- Reference< XGraphicProvider > xGraphicProvider( rxMSF->getServiceManager()->createInstanceWithContext( OUString::createFromAscii( "com.sun.star.graphic.GraphicProvider" ), rxMSF ), UNO_QUERY_THROW );
+ Reference< XGraphicProvider > xGraphicProvider( rxContext->getServiceManager()->createInstanceWithContext( OUString::createFromAscii( "com.sun.star.graphic.GraphicProvider" ), rxContext ), UNO_QUERY_THROW );
ImpCompressGraphic( xGraphicProvider, xGraphic, xOutputStream, aDestMimeType, aLogicalSize, rGraphicSettings.mnJPEGQuality, rGraphicSettings.mnImageResolution, bRemoveCropArea, aGraphicCropLogic );
Reference< XInputStream > xInputStream( xTempFile->getInputStream() );
@@ -370,9 +366,9 @@ Reference< XGraphic > ImpCompressGraphic
else // this is a metafile
{
rtl::OUString aDestMimeType( aSourceMimeType );
- Reference< XStream > xTempFile( rxMSF->getServiceManager()->createInstanceWithContext( OUString::createFromAscii( "com.sun.star.io.TempFile" ), rxMSF ), UNO_QUERY_THROW );
+ Reference< XStream > xTempFile( rxContext->getServiceManager()->createInstanceWithContext( OUString::createFromAscii( "com.sun.star.io.TempFile" ), rxContext ), UNO_QUERY_THROW );
Reference< XOutputStream > xOutputStream( xTempFile->getOutputStream() );
- Reference< XGraphicProvider > xGraphicProvider( rxMSF->getServiceManager()->createInstanceWithContext( OUString::createFromAscii( "com.sun.star.graphic.GraphicProvider" ), rxMSF ), UNO_QUERY_THROW );
+ Reference< XGraphicProvider > xGraphicProvider( rxContext->getServiceManager()->createInstanceWithContext( OUString::createFromAscii( "com.sun.star.graphic.GraphicProvider" ), rxContext ), UNO_QUERY_THROW );
ImpCompressGraphic( xGraphicProvider, xGraphic, xOutputStream, aDestMimeType, aLogicalSize, rGraphicSettings.mnJPEGQuality, rGraphicSettings.mnImageResolution, sal_False, aGraphicCropLogic );
Reference< XInputStream > xInputStream( xTempFile->getInputStream() );
Reference< XSeekable > xSeekable( xInputStream, UNO_QUERY_THROW );
@@ -390,7 +386,7 @@ Reference< XGraphic > ImpCompressGraphic
return xNewGraphic;
}
-void CompressGraphics( ImpOptimizer& rOptimizer, const Reference< XComponentContext >& rxMSF, const GraphicSettings& rGraphicSettings,
+void CompressGraphics( ImpOptimizer& rOptimizer, const Reference< XComponentContext >& rxContext, const GraphicSettings& rGraphicSettings,
std::vector< GraphicCollector::GraphicEntity >& rGraphicList )
{
try
@@ -425,8 +421,8 @@ void CompressGraphics( ImpOptimizer& rOp
if ( xGraphic.is() )
{
Reference< XPropertySet > xNewGraphicPropertySet( xGraphic, UNO_QUERY_THROW );
- awt::Size aSize100thMM( GraphicCollector::GetOriginalSize( rxMSF, xGraphic ) );
- Reference< XGraphic > xNewGraphic( ImpCompressGraphic( rxMSF, xGraphic, aGraphicIter->maLogicalSize, aGraphicIter->maGraphicCropLogic, aGraphicSettings ) );
+ awt::Size aSize100thMM( GraphicCollector::GetOriginalSize( rxContext, xGraphic ) );
+ Reference< XGraphic > xNewGraphic( ImpCompressGraphic( rxContext, xGraphic, aGraphicIter->maLogicalSize, aGraphicIter->maGraphicCropLogic, aGraphicSettings ) );
if ( xNewGraphic.is() )
{
// applying graphic to each user
@@ -446,7 +442,7 @@ void CompressGraphics( ImpOptimizer& rOp
text::GraphicCrop aGraphicCropLogic( 0, 0, 0, 0 );
if ( !aGraphicSettings.mbRemoveCropArea )
{
- awt::Size aNewSize( GraphicCollector::GetOriginalSize( rxMSF, xNewGraphic ) );
+ awt::Size aNewSize( GraphicCollector::GetOriginalSize( rxContext, xNewGraphic ) );
aGraphicCropLogic.Left = (sal_Int32)((double)aGraphicUserIter->maGraphicCropLogic.Left * ((double)aNewSize.Width / (double)aSize100thMM.Width));
aGraphicCropLogic.Top = (sal_Int32)((double)aGraphicUserIter->maGraphicCropLogic.Top * ((double)aNewSize.Height / (double)aSize100thMM.Height));
aGraphicCropLogic.Right = (sal_Int32)((double)aGraphicUserIter->maGraphicCropLogic.Right * ((double)aNewSize.Width / (double)aSize100thMM.Width));
@@ -497,8 +493,8 @@ void CompressGraphics( ImpOptimizer& rOp
// - ImpOptimizer -
// ----------------
-ImpOptimizer::ImpOptimizer( const Reference< XComponentContext >& rxMSF, const Reference< XModel >& rxModel ) :
- mxMSF ( rxMSF ),
+ImpOptimizer::ImpOptimizer( const Reference< XComponentContext >& rxContext, const Reference< XModel >& rxModel ) :
+ mxContext ( rxContext ),
mxModel ( rxModel ),
mbJPEGCompression ( sal_False ),
mnJPEGQuality ( 90 ),
@@ -512,30 +508,35 @@ ImpOptimizer::ImpOptimizer( const Refere
mbDeleteNotesPages ( sal_False ),
mbOpenNewDocument ( sal_True )
{
+ OSL_TRACE("ImpOptimizer::ImpOptimizer");
+ Reference< XController > xController( mxModel->getCurrentController() );
+ if (xController.is() )
+ mxFrame.set( xController->getFrame() );
}
// -----------------------------------------------------------------------------
ImpOptimizer::~ImpOptimizer()
{
+ OSL_TRACE("ImpOptimizer::~ImpOptimizer");
}
// -----------------------------------------------------------------------------
void ImpOptimizer::DispatchStatus()
{
- if ( mxStatusDispatcher.is() )
+ if ( mxStatusListener.is() )
{
- URL aURL;
- aURL.Protocol = OUString( RTL_CONSTASCII_USTRINGPARAM( "vnd.com.sun.star.comp.SunPresentationMinimizer:" ) );
- aURL.Path = OUString( RTL_CONSTASCII_USTRINGPARAM( "statusupdate" ) );
- mxStatusDispatcher->dispatch( aURL, GetStatusSequence() );
+ FeatureStateEvent aState;
+ aState.IsEnabled = sal_True;
+ aState.State <<= GetStatusSequence();
+ mxStatusListener->statusChanged( aState );
}
}
// -----------------------------------------------------------------------------
-sal_Bool ImpOptimizer::Optimize()
+sal_Bool ImpOptimizer::ImplOptimize()
{
if ( maCustomShowName.getLength() )
@@ -544,7 +545,7 @@ sal_Bool ImpOptimizer::Optimize()
if ( mbDeleteUnusedMasterPages )
{
SetStatusValue( TK_Progress, Any( static_cast< sal_Int32 >( 40 ) ) );
- SetStatusValue( TK_Status, Any( TKGet( STR_DELETING_SLIDES ) ) );
+ SetStatusValue( TK_Status, Any( ConfigurationAccess::getString( STR_DELETING_SLIDES ) ) );
DispatchStatus();
ImpDeleteUnusedMasterPages( mxModel );
}
@@ -552,14 +553,14 @@ sal_Bool ImpOptimizer::Optimize()
if ( mbDeleteHiddenSlides )
{
SetStatusValue( TK_Progress, Any( static_cast< sal_Int32 >( 40 ) ) );
- SetStatusValue( TK_Status, Any( TKGet( STR_DELETING_SLIDES ) ) );
+ SetStatusValue( TK_Status, Any( ConfigurationAccess::getString( STR_DELETING_SLIDES ) ) );
DispatchStatus();
ImpDeleteHiddenSlides( mxModel );
}
if ( mbDeleteNotesPages )
{
- SetStatusValue( TK_Status, Any( TKGet( STR_DELETING_SLIDES ) ) );
+ SetStatusValue( TK_Status, Any( ConfigurationAccess::getString( STR_DELETING_SLIDES ) ) );
DispatchStatus();
ImpDeleteNotesPages( mxModel );
}
@@ -567,7 +568,7 @@ sal_Bool ImpOptimizer::Optimize()
if ( mbOLEOptimization )
{
SetStatusValue( TK_Progress, Any( static_cast< sal_Int32 >( 45 ) ) );
- SetStatusValue( TK_Status, Any( TKGet( STR_CREATING_OLE_REPLACEMENTS ) ) );
+ SetStatusValue( TK_Status, Any( ConfigurationAccess::getString( STR_CREATING_OLE_REPLACEMENTS ) ) );
DispatchStatus();
ImpConvertOLE( mxModel, mnOLEOptimizationType );
}
@@ -575,13 +576,13 @@ sal_Bool ImpOptimizer::Optimize()
if ( mbJPEGCompression || mbRemoveCropArea || mnImageResolution )
{
SetStatusValue( TK_Progress, Any( static_cast< sal_Int32 >( 50 ) ) );
- SetStatusValue( TK_Status, Any( TKGet( STR_OPTIMIZING_GRAPHICS ) ) );
+ SetStatusValue( TK_Status, Any( ConfigurationAccess::getString( STR_OPTIMIZING_GRAPHICS ) ) );
DispatchStatus();
std::vector< GraphicCollector::GraphicEntity > aGraphicList;
GraphicSettings aGraphicSettings( mbJPEGCompression, mnJPEGQuality, mbRemoveCropArea, mnImageResolution, mbEmbedLinkedGraphics );
- GraphicCollector::CollectGraphics( mxMSF, mxModel, aGraphicSettings, aGraphicList );
- CompressGraphics( *this, mxMSF, aGraphicSettings, aGraphicList );
+ GraphicCollector::CollectGraphics( mxContext, mxModel, aGraphicSettings, aGraphicList );
+ CompressGraphics( *this, mxContext, aGraphicSettings, aGraphicList );
}
SetStatusValue( TK_Progress, Any( static_cast< sal_Int32 >( 100 ) ) );
DispatchStatus();
@@ -612,10 +613,12 @@ static void DispatchURL( Reference< XCom
sal_Bool ImpOptimizer::Optimize( const Sequence< PropertyValue >& rArguments )
{
+ OSL_TRACE("ImpOptimizer::Optimize");
sal_Bool bRet = sal_True;
if ( mxModel.is() )
{
+ Reference< XWindowPeer > xParentWindow;
sal_Int64 nEstimatedFileSize = 0;
SetStatusValue( TK_Progress, Any( static_cast< sal_Int32 >( 0 ) ) );
DispatchStatus();
@@ -625,8 +628,8 @@ sal_Bool ImpOptimizer::Optimize( const S
{
switch( TKGet( rArguments[ i ].Name ) )
{
- case TK_StatusDispatcher : rArguments[ i ].Value >>= mxStatusDispatcher; break;
- case TK_InformationDialog: rArguments[ i ].Value >>= mxInformationDialog; break;
+ case TK_StatusListener : rArguments[ i ].Value >>= mxStatusListener; break;
+ case TK_ParentWindow: rArguments[ i ].Value >>= xParentWindow; break;
case TK_Settings :
{
com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue > aSettings;
@@ -668,7 +671,7 @@ sal_Bool ImpOptimizer::Optimize( const S
{
SetStatusValue( TK_Progress, Any( static_cast< sal_Int32 >( 10 ) ) );
- SetStatusValue( TK_Status, Any( TKGet( STR_DUPLICATING_PRESENTATION ) ) );
+ SetStatusValue( TK_Status, Any( ConfigurationAccess::getString( STR_DUPLICATING_PRESENTATION ) ) );
DispatchStatus();
Reference< XStorable >xStorable( mxModel, UNO_QUERY );
@@ -690,11 +693,11 @@ sal_Bool ImpOptimizer::Optimize( const S
nSourceSize = PPPOptimizer::GetFileSize( maSaveAsURL );
SetStatusValue( TK_Progress, Any( static_cast< sal_Int32 >( 30 ) ) );
- SetStatusValue( TK_Status, Any( TKGet( STR_DUPLICATING_PRESENTATION ) ) );
+ SetStatusValue( TK_Status, Any( ConfigurationAccess::getString( STR_DUPLICATING_PRESENTATION ) ) );
DispatchStatus();
- Reference< XDesktop > xDesktop( mxMSF->getServiceManager()->createInstanceWithContext(
- OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.Desktop" ) ), mxMSF ), UNO_QUERY );
+ Reference< XDesktop > xDesktop( mxContext->getServiceManager()->createInstanceWithContext(
+ OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.Desktop" ) ), mxContext ), UNO_QUERY );
Reference< XFrame > xFrame( xDesktop, UNO_QUERY );
xSelf = xFrame->findFrame( TKGet( TK__blank ), FrameSearchFlag::CREATE );
Reference< XComponentLoader > xComponentLoader( xSelf, UNO_QUERY );
@@ -712,15 +715,15 @@ sal_Bool ImpOptimizer::Optimize( const S
if ( xStorable.is() && !xStorable->isReadonly() )
{
mxModel->lockControllers();
- bRet = Optimize();
+ bRet = ImplOptimize();
mxModel->unlockControllers();
// clearing undo stack:
- Reference< XFrame > xFrame( xSelf.is() ? xSelf : mxInformationDialog );
+ Reference< XFrame > xFrame( mxFrame );
if ( xFrame.is() )
{
const OUString sSlot( RTL_CONSTASCII_USTRINGPARAM( "slot:27115" ) );
- DispatchURL( mxMSF, sSlot, xFrame );
+ DispatchURL( mxContext, sSlot, xFrame );
}
}
@@ -733,9 +736,11 @@ sal_Bool ImpOptimizer::Optimize( const S
}
}
- if ( mxInformationDialog.is() )
+ if ( xParentWindow.is() )
{
- InformationDialog aInformationDialog( mxMSF, mxInformationDialog, maSaveAsURL, mbOpenNewDocument, nSourceSize, nDestSize, nEstimatedFileSize );
+ InformationDialog aInformationDialog(
+ mxContext, xParentWindow, maSaveAsURL, mbOpenNewDocument,
+ nSourceSize, nDestSize, nEstimatedFileSize );
aInformationDialog.execute();
SetStatusValue( TK_OpenNewDocument, Any( mbOpenNewDocument ) );
DispatchStatus();
Modified: openoffice/branches/ia2/main/sdext/source/minimizer/impoptimizer.hxx
URL: http://svn.apache.org/viewvc/openoffice/branches/ia2/main/sdext/source/minimizer/impoptimizer.hxx?rev=1470868&r1=1470867&r2=1470868&view=diff
==============================================================================
--- openoffice/branches/ia2/main/sdext/source/minimizer/impoptimizer.hxx (original)
+++ openoffice/branches/ia2/main/sdext/source/minimizer/impoptimizer.hxx Tue Apr 23 09:51:15 2013
@@ -35,6 +35,7 @@
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#endif
#include <com/sun/star/uno/XComponentContext.hpp>
+#include <com/sun/star/awt/XWindowPeer.hpp>
class Point;
class Size;
@@ -47,9 +48,9 @@ class ImpOptimizer : public Optimization
{
private:
- com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext > mxMSF;
+ com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext > mxContext;
com::sun::star::uno::Reference< com::sun::star::frame::XModel > mxModel;
- com::sun::star::uno::Reference< com::sun::star::frame::XDispatch > mxStatusDispatcher;
+ com::sun::star::uno::Reference< com::sun::star::frame::XStatusListener > mxStatusListener;
sal_Bool mbJPEGCompression;
sal_Int32 mnJPEGQuality;
@@ -66,9 +67,9 @@ private:
rtl::OUString maFilterName;
sal_Bool mbOpenNewDocument;
- com::sun::star::uno::Reference< com::sun::star::frame::XFrame > mxInformationDialog;
+ com::sun::star::uno::Reference< com::sun::star::frame::XFrame > mxFrame;
- sal_Bool Optimize();
+ sal_Bool ImplOptimize();
public: