Kaydet (Commit) a9ec212c authored tarafından Regina Henschel's avatar Regina Henschel

tdf#67248 Use localized layer name only for display in UI

The internal management of layers was based on localized layer names.
So it could happen, that a custom layer name was a standard layer
name (which includes special handling) in one local and not in the
other. The patch changes the implementation to use the same real
layer names as in file, and use localized standard layer names only
for display in the UI.
Removes no longer needed RestoreLayerName()
Removes convertToInternalName(), ersatz convertToLocalizedName()
Removes no longer needed convertToExternalName()
Includes fix for tdf#119956 in addition

Change-Id: Iaedb73e4017e728f7ca3b0dc4aa7bb7f0e6ce6da
Reviewed-on: https://gerrit.libreoffice.org/60507
Tested-by: Jenkins
Reviewed-by: 's avatarRegina Henschel <rb.henschel@t-online.de>
üst ed480e91
......@@ -376,6 +376,8 @@ private:
protected:
virtual void AddTabClick();
OUString GetAuxiliaryText(sal_uInt16 nPageId) const; // needed in derived class LayerTabBar
void SetAuxiliaryText(sal_uInt16 nPageId, const OUString& rText );
public:
static const sal_uInt16 APPEND;
......@@ -405,7 +407,7 @@ public:
virtual void EndRenaming();
virtual void Mirror();
void InsertPage( sal_uInt16 nPageId, const OUString& rText,
virtual void InsertPage( sal_uInt16 nPageId, const OUString& rText,
TabBarPageBits nBits = TabBarPageBits::NONE,
sal_uInt16 nPos = TabBar::APPEND );
void RemovePage( sal_uInt16 nPageId );
......@@ -474,7 +476,7 @@ public:
void SwitchPage( const Point& rPos );
void EndSwitchPage();
void SetPageText( sal_uInt16 nPageId, const OUString& rText );
virtual void SetPageText( sal_uInt16 nPageId, const OUString& rText );
OUString GetPageText( sal_uInt16 nPageId ) const;
OUString GetHelpText( sal_uInt16 nPageId ) const;
OString GetHelpId( sal_uInt16 nPageId ) const;
......
......@@ -100,6 +100,7 @@
#include <undopage.hxx>
#include <tools/tenccvt.hxx>
#include <vcl/settings.hxx>
#include <unokywds.hxx>
using namespace ::sd;
using namespace ::com::sun::star;
......@@ -313,28 +314,34 @@ SdDrawDocument::SdDrawDocument(DocumentType eType, SfxObjectShell* pDrDocSh)
*
* We create the following default layers on all pages and master pages:
*
* STR_LAYOUT : default layer for drawing objects
* sUNO_LayerName_layout; "layout": default layer for drawing objects of normal pages
* localized by SdResId(STR_LAYER_LAYOUT)
*
* STR_BCKGRND : background of the master page
* (currently unused within normal pages)
* sUNO_LayerName_background; "background": background of the master page
* localized by SdResId(STR_LAYER_BCKGRND)
* (currently unused within normal pages and not visible to users)
*
* STR_BCKGRNDOBJ: objects on the background of master pages
* (currently unused within normal pages)
* sUNO_LayerName_background_objects; "backgroundobjects": objects on the background of master pages
* localized by SdResId(STR_LAYER_BCKGRNDOBJ)
* (currently unused within normal pages)
*
* STR_CONTROLS : default layer for controls
* sUNO_LayerName_controls; "controls": default layer for controls
* localized by SdResId(STR_LAYER_CONTROLS)
* (currently special handling in regard to z-order)
*
* sUNO_LayerName_measurelines; "measurelines" : default layer for measure lines
* localized by SdResId(STR_LAYER_MEASURELINES)
*/
{
OUString aControlLayerName( SdResId(STR_LAYER_CONTROLS) );
SdrLayerAdmin& rLayerAdmin = GetLayerAdmin();
rLayerAdmin.NewLayer( SdResId(STR_LAYER_LAYOUT) );
rLayerAdmin.NewLayer( SdResId(STR_LAYER_BCKGRND) );
rLayerAdmin.NewLayer( SdResId(STR_LAYER_BCKGRNDOBJ) );
rLayerAdmin.NewLayer( aControlLayerName );
rLayerAdmin.NewLayer( SdResId(STR_LAYER_MEASURELINES) );
rLayerAdmin.NewLayer( sUNO_LayerName_layout );
rLayerAdmin.NewLayer( sUNO_LayerName_background );
rLayerAdmin.NewLayer( sUNO_LayerName_background_objects );
rLayerAdmin.NewLayer( sUNO_LayerName_controls);
rLayerAdmin.NewLayer( sUNO_LayerName_measurelines );
rLayerAdmin.SetControlLayerName(aControlLayerName);
rLayerAdmin.SetControlLayerName(sUNO_LayerName_controls);
}
}
......@@ -753,9 +760,6 @@ void SdDrawDocument::NewOrLoadCompleted(DocCreationMode eMode)
pPage->SetName( aName );
}
// Create names of the default layers in the user's language
RestoreLayerNames();
// Create names of the styles in the user's language
static_cast<SdStyleSheetPool*>(mxStyleSheetPool.get())->UpdateStdNames();
......
......@@ -68,6 +68,7 @@
#include "PageListWatcher.hxx"
#include <vcl/virdev.hxx>
#include <customshowlist.hxx>
#include <unokywds.hxx>
using namespace ::sd;
......@@ -1342,8 +1343,8 @@ sal_uInt16 SdDrawDocument::DuplicatePage (sal_uInt16 nPageNum)
// Get background flags
SdrLayerAdmin& rLayerAdmin = GetLayerAdmin();
SdrLayerID aBckgrnd = rLayerAdmin.GetLayerID(SdResId(STR_LAYER_BCKGRND));
SdrLayerID aBckgrndObj = rLayerAdmin.GetLayerID(SdResId(STR_LAYER_BCKGRNDOBJ));
SdrLayerID aBckgrnd = rLayerAdmin.GetLayerID(sUNO_LayerName_background);
SdrLayerID aBckgrndObj = rLayerAdmin.GetLayerID(sUNO_LayerName_background_objects);
SdrLayerIDSet aVisibleLayers = pActualPage->TRG_GetMasterPageVisibleLayers();
return DuplicatePage (
......@@ -1486,8 +1487,8 @@ void SdDrawDocument::SetupNewPage (
if (pPreviousPage != nullptr)
{
SdrLayerAdmin& rLayerAdmin = GetLayerAdmin();
SdrLayerID aBckgrnd = rLayerAdmin.GetLayerID(SdResId(STR_LAYER_BCKGRND));
SdrLayerID aBckgrndObj = rLayerAdmin.GetLayerID(SdResId(STR_LAYER_BCKGRNDOBJ));
SdrLayerID aBckgrnd = rLayerAdmin.GetLayerID(sUNO_LayerName_background);
SdrLayerID aBckgrndObj = rLayerAdmin.GetLayerID(sUNO_LayerName_background_objects);
SdrLayerIDSet aVisibleLayers = pPreviousPage->TRG_GetMasterPageVisibleLayers();
aVisibleLayers.Set(aBckgrnd, bIsPageBack);
aVisibleLayers.Set(aBckgrndObj, bIsPageObj);
......
......@@ -1065,45 +1065,6 @@ void SdDrawDocument::ImpOnlineSpellCallback(SpellCallbackInfo const * pInfo, Sdr
SfxViewFrame::Current()->GetDispatcher()->Execute( SID_AUTO_CORRECT_DLG, SfxCallMode::ASYNCHRON );
}
// Replace the unambiguous names of the default layers by their names in the
// native language
void SdDrawDocument::RestoreLayerNames()
{
SdrLayerAdmin& rLayerAdmin = GetLayerAdmin();
sal_uInt16 nLayerCount = rLayerAdmin.GetLayerCount();
for (sal_uInt16 nLayer = 0; nLayer < nLayerCount; nLayer++)
{
SdrLayer* pLayer = rLayerAdmin.GetLayer(nLayer);
if (pLayer)
{
OUString aLayerName(pLayer->GetName());
if (aLayerName == "LAYER_LAYOUT")
{
pLayer->SetName(SdResId(STR_LAYER_LAYOUT));
}
else if (aLayerName == "LAYER_BCKGRND")
{
pLayer->SetName(SdResId(STR_LAYER_BCKGRND));
}
else if (aLayerName == "LAYER_BACKGRNDOBJ")
{
pLayer->SetName(SdResId(STR_LAYER_BCKGRNDOBJ));
}
else if (aLayerName == "LAYER_CONTROLS")
{
pLayer->SetName(SdResId(STR_LAYER_CONTROLS));
}
else if (aLayerName == "LAYER_MEASURELINES")
{
pLayer->SetName(SdResId(STR_LAYER_MEASURELINES));
}
}
}
}
// Return formatted page number (1, I, i, a, etc.)
OUString SdDrawDocument::CreatePageNumValue(sal_uInt16 nNum) const
{
......
......@@ -82,6 +82,7 @@
#include <svx/sdr/contact/viewcontact.hxx>
#include <svx/sdr/contact/objectcontact.hxx>
#include <svx/unoapi.hxx>
#include <unokywds.hxx>
#include <set>
......@@ -529,8 +530,7 @@ SdrObject* SdPage::CreatePresObj(PresObjKind eObjKind, bool bVertical, const ::t
SdrLayerAdmin& rLayerAdmin(getSdrModelFromSdrPage().GetLayerAdmin());
// background objects of the master page
pSdrObj->SetLayer( rLayerAdmin.
GetLayerID(SdResId(STR_LAYER_BCKGRNDOBJ)) );
pSdrObj->SetLayer( rLayerAdmin.GetLayerID(sUNO_LayerName_background_objects) );
}
// Subscribe object at the style sheet
......
......@@ -76,6 +76,7 @@
#include <DrawDocShell.hxx>
#include <FrameView.hxx>
#include <optsitem.hxx>
#include <unokywds.hxx>
#include <unotools/fltrcfg.hxx>
#include <sfx2/progress.hxx>
......@@ -251,8 +252,8 @@ bool ImplSdPPTImport::Import()
const_cast<EditEngine&>(rOutl.GetEditEngine()).SetControlWord( nControlWord );
SdrLayerAdmin& rAdmin = mpDoc->GetLayerAdmin();
mnBackgroundLayerID = rAdmin.GetLayerID( SdResId( STR_LAYER_BCKGRND ) );
mnBackgroundObjectsLayerID = rAdmin.GetLayerID( SdResId( STR_LAYER_BCKGRNDOBJ ) );
mnBackgroundLayerID = rAdmin.GetLayerID( sUNO_LayerName_background );
mnBackgroundObjectsLayerID = rAdmin.GetLayerID( sUNO_LayerName_background_objects );
::sd::DrawDocShell* pDocShell = mpDoc->GetDocSh();
if ( pDocShell )
......
......@@ -707,11 +707,12 @@ uno::Any SAL_CALL AccessibleDocumentViewBase::getExtendedAttributes()
{
sName = "page-name:";
sValue = sName;
OUString sLayerName(pDrViewSh->GetLayerTabControl()->GetLayerName(pDrViewSh->GetLayerTabControl()->GetCurPageId()) );
sDisplay = pDrViewSh->GetLayerTabControl()->GetPageText(pDrViewSh->GetLayerTabControl()->GetCurPageId());
if( pDoc )
{
SdrLayerAdmin& rLayerAdmin = pDoc->GetLayerAdmin();
SdrLayer* aSdrLayer = rLayerAdmin.GetLayer(sDisplay);
SdrLayer* aSdrLayer = rLayerAdmin.GetLayer(sLayerName);
if( aSdrLayer )
{
OUString layerAltText = aSdrLayer->GetTitle();
......
......@@ -35,6 +35,7 @@
#include <View.hxx>
#include <drawdoc.hxx>
#include <sdresid.hxx>
#include <unokywds.hxx>
#include <DrawDocShell.hxx>
#include <drawview.hxx>
#include <undolayer.hxx>
......@@ -66,6 +67,71 @@ void LayerTabBar::dispose()
TabBar::dispose();
}
OUString LayerTabBar::convertToLocalizedName(const OUString& rName)
{
if ( rName == sUNO_LayerName_background )
return SdResId( STR_LAYER_BCKGRND );
if ( rName == sUNO_LayerName_background_objects )
return SdResId( STR_LAYER_BCKGRNDOBJ );
if ( rName == sUNO_LayerName_layout )
return SdResId( STR_LAYER_LAYOUT );
if ( rName == sUNO_LayerName_controls )
return SdResId( STR_LAYER_CONTROLS );
if ( rName == sUNO_LayerName_measurelines )
return SdResId( STR_LAYER_MEASURELINES );
return rName;
}
// Use a method name, that is specific to LayerTabBar to make code better readable
OUString LayerTabBar::GetLayerName(sal_uInt16 nPageId) const
{
return GetAuxiliaryText(nPageId);
}
void LayerTabBar::SetLayerName( sal_uInt16 nPageId, const OUString& rText )
{
SetAuxiliaryText(nPageId, rText);
}
// Here "Page" is a tab in the LayerTabBar.
void LayerTabBar::InsertPage( sal_uInt16 nPageId, const OUString& rText,
TabBarPageBits nBits, sal_uInt16 nPos)
{
OUString sLocalizedName(convertToLocalizedName(rText));
TabBar::InsertPage(nPageId, sLocalizedName, nBits, nPos );
SetLayerName(nPageId, rText);
}
void LayerTabBar::SetPageText( sal_uInt16 nPageId, const OUString& rText )
{
OUString sLocalizedName(convertToLocalizedName(rText));
SetLayerName(nPageId, rText);
TabBar::SetPageText(nPageId, sLocalizedName);
}
bool LayerTabBar::IsLocalizedNameOfStandardLayer(const OUString& rName)
{
return ( rName == SdResId(STR_LAYER_LAYOUT)
|| rName == SdResId(STR_LAYER_CONTROLS)
|| rName == SdResId(STR_LAYER_MEASURELINES)
|| rName == SdResId(STR_LAYER_BCKGRND)
|| rName == SdResId(STR_LAYER_BCKGRNDOBJ) );
}
bool LayerTabBar::IsRealNameOfStandardLayer(const OUString& rName)
{
return ( rName == sUNO_LayerName_layout
|| rName == sUNO_LayerName_controls
|| rName == sUNO_LayerName_measurelines
|| rName == sUNO_LayerName_background
|| rName == sUNO_LayerName_background_objects );
}
void LayerTabBar::Select()
{
SfxDispatcher* pDispatcher = pDrViewSh->GetViewFrame()->GetDispatcher();
......@@ -76,23 +142,32 @@ void LayerTabBar::MouseButtonDown(const MouseEvent& rMEvt)
{
bool bSetPageID=false;
if (rMEvt.IsLeft() && !rMEvt.IsMod2())
if (rMEvt.IsLeft())
{
Point aPosPixel = rMEvt.GetPosPixel();
sal_uInt16 aLayerId = GetPageId( PixelToLogic(aPosPixel) );
if (aLayerId == 0)
sal_uInt16 aTabId = GetPageId( PixelToLogic(aPosPixel) );
if (aTabId == 0)
{
SfxDispatcher* pDispatcher = pDrViewSh->GetViewFrame()->GetDispatcher();
pDispatcher->Execute(SID_INSERTLAYER, SfxCallMode::SYNCHRON);
bSetPageID=true;
}
else if (rMEvt.IsMod2())
{
// direct editing of tab text
// make sure the clicked tab is the current tab otherwise Edit() acts on the wrong tab
if ( aTabId != GetCurPageId())
{
MouseEvent aSyntheticEvent (rMEvt.GetPosPixel(), 1, MouseEventModifiers::SYNTHETIC, MOUSE_LEFT, 0);
TabBar::MouseButtonDown(aSyntheticEvent);
}
}
else if (rMEvt.IsMod1() || rMEvt.IsShift())
{
// keyboard Shortcuts to change layer attributes
OUString aName(GetPageText(aLayerId));
OUString aName(GetLayerName(aTabId));
SdrPageView* pPV = pDrViewSh->GetView()->GetSdrPageView();
// Save old state
......@@ -195,8 +270,8 @@ sal_Int8 LayerTabBar::AcceptDrop( const AcceptDropEvent& rEvt )
if( !pDrViewSh->GetDocSh()->IsReadOnly() )
{
Point aPos( PixelToLogic( rEvt.maPosPixel ) );
SdrLayerID nLayerId = pDrViewSh->GetView()->GetDoc().GetLayerAdmin().GetLayerID(
GetPageText( GetPageId( aPos ) ) );
OUString sLayerName( GetLayerName(GetPageId(aPos)) );
SdrLayerID nLayerId = pDrViewSh->GetView()->GetDoc().GetLayerAdmin().GetLayerID(sLayerName);
nRet = pDrViewSh->AcceptDrop( rEvt, *this, nullptr, SDRPAGE_NOTFOUND, nLayerId );
......@@ -211,8 +286,10 @@ sal_Int8 LayerTabBar::AcceptDrop( const AcceptDropEvent& rEvt )
*/
sal_Int8 LayerTabBar::ExecuteDrop( const ExecuteDropEvent& rEvt )
{
SdrLayerID nLayerId = pDrViewSh->GetView()->GetDoc().GetLayerAdmin().GetLayerID(
GetPageText( GetPageId( PixelToLogic( rEvt.maPosPixel ) ) ) );
Point aPos( PixelToLogic(rEvt.maPosPixel) );
OUString sLayerName( GetLayerName(GetPageId(aPos)) );
SdrLayerID nLayerId = pDrViewSh->GetView()->GetDoc().GetLayerAdmin().GetLayerID(sLayerName);
sal_Int8 nRet = pDrViewSh->ExecuteDrop( rEvt, *this, nullptr, SDRPAGE_NOTFOUND, nLayerId );
EndSwitchPage();
......@@ -233,18 +310,11 @@ void LayerTabBar::Command(const CommandEvent& rCEvt)
bool LayerTabBar::StartRenaming()
{
bool bOK = true;
OUString aLayerName = GetPageText( GetEditPageId() );
OUString aLayoutLayer = SdResId(STR_LAYER_LAYOUT);
OUString aControlsLayer = SdResId(STR_LAYER_CONTROLS);
OUString aMeasureLinesLayer = SdResId(STR_LAYER_MEASURELINES);
OUString aBackgroundLayer = SdResId(STR_LAYER_BCKGRND);
OUString aBackgroundObjLayer = SdResId(STR_LAYER_BCKGRNDOBJ);
if ( aLayerName == aLayoutLayer || aLayerName == aControlsLayer ||
aLayerName == aMeasureLinesLayer ||
aLayerName == aBackgroundLayer || aLayerName == aBackgroundObjLayer )
OUString aLayerName = GetLayerName( GetEditPageId() );
if ( IsRealNameOfStandardLayer(aLayerName))
{
// It is not allowed to change this names
// It is not allowed to change these names
bOK = false;
}
else
......@@ -274,7 +344,7 @@ TabBarAllowRenamingReturnCode LayerTabBar::AllowRenaming()
if (aNewName.isEmpty() ||
(rLayerAdmin.GetLayer( aNewName ) && aLayerName != aNewName) )
{
// Name already exists
// Name already exists.
std::unique_ptr<weld::MessageDialog> xWarn(Application::CreateMessageDialog(pDrViewSh->GetViewFrame()->GetWindow().GetFrameWeld(),
VclMessageType::Warning, VclButtonsType::Ok,
SdResId(STR_WARN_NAME_DUPLICATE)));
......@@ -284,17 +354,9 @@ TabBarAllowRenamingReturnCode LayerTabBar::AllowRenaming()
if (bOK)
{
OUString aLayoutLayer = SdResId(STR_LAYER_LAYOUT);
OUString aControlsLayer = SdResId(STR_LAYER_CONTROLS);
OUString aMeasureLinesLayer = SdResId(STR_LAYER_MEASURELINES);
OUString aBackgroundLayer = SdResId(STR_LAYER_BCKGRND);
OUString aBackgroundObjLayer = SdResId(STR_LAYER_BCKGRNDOBJ);
if ( aNewName == aLayoutLayer || aNewName == aControlsLayer ||
aNewName == aMeasureLinesLayer ||
aNewName == aBackgroundLayer || aNewName == aBackgroundObjLayer )
if ( IsLocalizedNameOfStandardLayer(aNewName) || IsRealNameOfStandardLayer(aNewName) )
{
// It is not allowed to use his names
// Standard layer names may not be changed.
bOK = false;
}
}
......
......@@ -59,6 +59,7 @@
#include <Window.hxx>
#include <stlpool.hxx>
#include <drawdoc.hxx>
#include <unokywds.hxx>
#include <strings.hrc>
......@@ -233,8 +234,7 @@ bool FuConstructRectangle::MouseButtonUp(const MouseEvent& rMEvt)
if(SID_DRAW_MEASURELINE == nSlotId)
{
SdrLayerAdmin& rAdmin = mpDoc->GetLayerAdmin();
OUString aStr(SdResId(STR_LAYER_MEASURELINES));
pObj->SetLayer(rAdmin.GetLayerID(aStr));
pObj->SetLayer(rAdmin.GetLayerID(sUNO_LayerName_measurelines));
}
// init text position when vertical caption object is created
......@@ -493,8 +493,7 @@ void FuConstructRectangle::SetAttributes(SfxItemSet& rAttr, SdrObject* pObj)
}
SdrLayerAdmin& rAdmin = mpDoc->GetLayerAdmin();
OUString aStr(SdResId(STR_LAYER_MEASURELINES));
pObj->SetLayer(rAdmin.GetLayerID(aStr));
pObj->SetLayer(rAdmin.GetLayerID(sUNO_LayerName_measurelines));
}
}
......
......@@ -37,7 +37,7 @@
#include <ViewShellBase.hxx>
#include <ToolBarManager.hxx>
#include <drawdoc.hxx>
#include <sdresid.hxx>
#include <unokywds.hxx>
namespace sd {
......@@ -122,7 +122,7 @@ void FuConstructUnoControl::Activate()
mpWindow->SetPointer( aNewPointer );
aOldLayer = mpView->GetActiveLayer();
mpView->SetActiveLayer( SdResId(STR_LAYER_CONTROLS) );
mpView->SetActiveLayer(sUNO_LayerName_controls);
FuConstruct::Activate();
}
......
......@@ -53,6 +53,27 @@ public:
*/
void SendDeactivatePageEvent();
// Expects not-localized, real layer name in rText. Generates a localized layer name
// that will be displayed on the tab of the LayerTabBar and writes the real name
// to maAuxiliaryText. In case you want no entry in maAuxiliaryText, use method from TabBar.
virtual void InsertPage( sal_uInt16 nPageId, const OUString& rText,
TabBarPageBits nBits = TabBarPageBits::NONE,
sal_uInt16 nPos = TabBar::APPEND ) override;
virtual void SetPageText( sal_uInt16 nPageId, const OUString& rText ) override;
// Returns the real layer name if exists and empty OUString otherwise.
OUString GetLayerName(sal_uInt16 nPageId) const;
// Used e.g. in DeleteActualLayer() to test whether deleting is allowed.
static bool IsRealNameOfStandardLayer(const OUString& rName);
// Used e.g. in validity test of user entered names
static bool IsLocalizedNameOfStandardLayer(const OUString& rName);
// In case rName is one of the sUNO_LayerName_*, it generates a localized name,
// otherwise it returns value of rName.
static OUString convertToLocalizedName(const OUString& rName);
private:
DrawViewShell* pDrViewSh;
......@@ -72,6 +93,9 @@ private:
// DropTargetHelper
virtual sal_Int8 AcceptDrop( const AcceptDropEvent& rEvt ) override;
virtual sal_Int8 ExecuteDrop( const ExecuteDropEvent& rEvt ) override;
// Expects not-localized, real layer name in rText and writes it to maAuxiliaryText.
void SetLayerName( sal_uInt16 nPageId, const OUString& rText );
};
} // end of namespace sd
......
......@@ -29,6 +29,7 @@
#include <sdpage.hxx>
#include <sdresid.hxx>
#include <unokywds.hxx>
#include <bitmaps.hlst>
#include <tools/SlotStateListener.hxx>
#include <DrawController.hxx>
......@@ -454,10 +455,8 @@ SfxRequest LayoutMenu::CreateRequest (
do
{
SdrLayerAdmin& rLayerAdmin (mrBase.GetDocument()->GetLayerAdmin());
SdrLayerID aBackground (rLayerAdmin.GetLayerID(
SdResId(STR_LAYER_BCKGRND)));
SdrLayerID aBackgroundObject (rLayerAdmin.GetLayerID(
SdResId(STR_LAYER_BCKGRNDOBJ)));
SdrLayerID aBackground (rLayerAdmin.GetLayerID(sUNO_LayerName_background));
SdrLayerID aBackgroundObject (rLayerAdmin.GetLayerID(sUNO_LayerName_background_objects));
ViewShell* pViewShell = mrBase.GetMainViewShell().get();
if (pViewShell == nullptr)
break;
......
......@@ -51,6 +51,7 @@
#include <app.hrc>
#include <strings.hrc>
#include <sdresid.hxx>
#include <unokywds.hxx>
#include <drawdoc.hxx>
#include <DrawDocShell.hxx>
#include <ViewShellBase.hxx>
......@@ -940,8 +941,8 @@ bool SlotManager::RenameSlideFromDrawViewShell( sal_uInt16 nPageId, const OUStri
// Undo
SdPage* pUndoPage = pPageToRename;
SdrLayerAdmin & rLayerAdmin = pDocument->GetLayerAdmin();
SdrLayerID nBackground = rLayerAdmin.GetLayerID( SdResId( STR_LAYER_BCKGRND ) );
SdrLayerID nBgObj = rLayerAdmin.GetLayerID( SdResId( STR_LAYER_BCKGRNDOBJ ) );
SdrLayerID nBackground = rLayerAdmin.GetLayerID(sUNO_LayerName_background);
SdrLayerID nBgObj = rLayerAdmin.GetLayerID(sUNO_LayerName_background_objects);
SdrLayerIDSet aVisibleLayers = pPageToRename->TRG_GetMasterPageVisibleLayers();
// (#67720#)
......
......@@ -75,62 +75,6 @@ static const SvxItemPropertySet* ImplGetSdLayerPropertySet()
return &aSDLayerPropertySet_Impl;
}
OUString SdLayer::convertToInternalName( const OUString& rName )
{
if ( rName == sUNO_LayerName_background )
{
return SdResId( STR_LAYER_BCKGRND );
}
else if ( rName == sUNO_LayerName_background_objects )
{
return SdResId( STR_LAYER_BCKGRNDOBJ );
}
else if ( rName == sUNO_LayerName_layout )
{
return SdResId( STR_LAYER_LAYOUT );
}
else if ( rName == sUNO_LayerName_controls )
{
return SdResId( STR_LAYER_CONTROLS );
}
else if ( rName == sUNO_LayerName_measurelines )
{
return SdResId( STR_LAYER_MEASURELINES );
}
else
{
return rName;
}
}
OUString SdLayer::convertToExternalName( const OUString& rName )
{
if( rName == SdResId( STR_LAYER_BCKGRND ) )
{
return OUString( sUNO_LayerName_background );
}
else if( rName == SdResId( STR_LAYER_BCKGRNDOBJ ) )
{
return OUString( sUNO_LayerName_background_objects );
}
else if( rName == SdResId( STR_LAYER_LAYOUT ) )
{
return OUString( sUNO_LayerName_layout );
}
else if( rName == SdResId( STR_LAYER_CONTROLS ) )
{
return OUString( sUNO_LayerName_controls );
}
else if( rName == SdResId( STR_LAYER_MEASURELINES ) )
{
return OUString( sUNO_LayerName_measurelines );
}
else
{
return rName;
}
}
SdLayer::SdLayer(SdLayerManager* pLayerManager_, SdrLayer* pSdrLayer_)
: mxLayerManager(pLayerManager_)
, pLayer(pSdrLayer_)
......@@ -208,7 +152,7 @@ void SAL_CALL SdLayer::setPropertyValue( const OUString& aPropertyName, const un
if(!(aValue >>= aName))
throw lang::IllegalArgumentException();
pLayer->SetName(SdLayer::convertToInternalName( aName ) );
pLayer->SetName(aName);
mxLayerManager->UpdateLayerView();
break;
}
......@@ -265,7 +209,7 @@ uno::Any SAL_CALL SdLayer::getPropertyValue( const OUString& PropertyName )
break;
case WID_LAYER_NAME:
{
OUString aRet( SdLayer::convertToExternalName( pLayer->GetName() ) );
OUString aRet(pLayer->GetName());
aValue <<= aRet;
break;
}
......@@ -614,7 +558,7 @@ uno::Any SAL_CALL SdLayerManager::getByName( const OUString& aName )
throw lang::DisposedException();
SdrLayerAdmin& rLayerAdmin = mpModel->mpDoc->GetLayerAdmin();
SdrLayer* pLayer = rLayerAdmin.GetLayer( SdLayer::convertToInternalName( aName ) );
SdrLayer* pLayer = rLayerAdmin.GetLayer(aName);
if( pLayer == nullptr )
throw container::NoSuchElementException();
......@@ -639,7 +583,7 @@ uno::Sequence< OUString > SAL_CALL SdLayerManager::getElementNames()
{
SdrLayer* pLayer = rLayerAdmin.GetLayer( nLayer );
if( pLayer )
*pStrings++ = SdLayer::convertToExternalName( pLayer->GetName() );
*pStrings++ = pLayer->GetName();
}
return aSeq;
......@@ -654,7 +598,7 @@ sal_Bool SAL_CALL SdLayerManager::hasByName( const OUString& aName )
SdrLayerAdmin& rLayerAdmin = mpModel->mpDoc->GetLayerAdmin();
return nullptr != rLayerAdmin.GetLayer( SdLayer::convertToInternalName( aName ) );
return nullptr != rLayerAdmin.GetLayer(aName);
}
// XElementAccess
......
......@@ -55,9 +55,6 @@ public:
// intern
SdrLayer* GetSdrLayer() const throw() { return pLayer; }
static OUString convertToInternalName( const OUString& rName );
static OUString convertToExternalName( const OUString& rName );
// uno helper
UNO3_GETIMPLEMENTATION_DECL( SdLayer )
......
......@@ -471,8 +471,8 @@ SdPage* SdXImpressDocument::InsertSdPage( sal_uInt16 nPage, bool bDuplicate )
{
sal_uInt16 nPageCount = mpDoc->GetSdPageCount( PageKind::Standard );
SdrLayerAdmin& rLayerAdmin = mpDoc->GetLayerAdmin();
SdrLayerID aBckgrnd = rLayerAdmin.GetLayerID(SdResId(STR_LAYER_BCKGRND));
SdrLayerID aBckgrndObj = rLayerAdmin.GetLayerID(SdResId(STR_LAYER_BCKGRNDOBJ));
SdrLayerID aBckgrnd = rLayerAdmin.GetLayerID(sUNO_LayerName_background);
SdrLayerID aBckgrndObj = rLayerAdmin.GetLayerID(sUNO_LayerName_background_objects);
SdPage* pStandardPage = nullptr;
......@@ -531,8 +531,8 @@ SdPage* SdXImpressDocument::InsertSdPage( sal_uInt16 nPage, bool bDuplicate )
pStandardPage->SetAutoLayout(AUTOLAYOUT_NONE, true );
}
aBckgrnd = rLayerAdmin.GetLayerID(SdResId(STR_LAYER_BCKGRND));
aBckgrndObj = rLayerAdmin.GetLayerID(SdResId(STR_LAYER_BCKGRNDOBJ));
aBckgrnd = rLayerAdmin.GetLayerID(sUNO_LayerName_background);
aBckgrndObj = rLayerAdmin.GetLayerID(sUNO_LayerName_background_objects);
aVisibleLayers.Set(aBckgrnd, bIsPageBack);
aVisibleLayers.Set(aBckgrndObj, bIsPageObj);
pStandardPage->TRG_SetMasterPageVisibleLayers(aVisibleLayers);
......
......@@ -387,16 +387,6 @@ uno::Any SAL_CALL SdXShape::getPropertyDefault( const OUString& aPropertyName )
else
{
uno::Any aRet( mpShape->_getPropertyDefault(aPropertyName) );
if ( aPropertyName == sUNO_shape_layername )
{
OUString aName;
if( aRet >>= aName )
{
aName = SdLayer::convertToExternalName( aName );
aRet <<= aName;
}
}
return aRet;
}
}
......@@ -660,17 +650,6 @@ void SAL_CALL SdXShape::setPropertyValue( const OUString& aPropertyName, const c
else
{
uno::Any aAny( aValue );
if ( aPropertyName == sUNO_shape_layername )
{
OUString aName;
if( aAny >>= aName )
{
aName = SdLayer::convertToInternalName( aName );