Kaydet (Commit) 42d68ead authored tarafından Caolán McNamara's avatar Caolán McNamara

unroll IMG_NAVI_ENTRYBMP ImageList

Change-Id: Icb00102f064b845b33a072880c60a9aae5dc4a55
üst dae92e11
......@@ -73,7 +73,6 @@ class SwContentTree
, public SfxListener
{
VclPtr<SwNavigationPI> m_xDialog;
ImageList m_aEntryImages;
OUString m_sSpace;
AutoTimer m_aUpdTimer;
......@@ -111,7 +110,6 @@ class SwContentTree
bool m_bIsLastReadOnly :1;
bool m_bIsOutlineMoveable :1;
bool m_bViewHasChanged :1;
bool m_bIsImageListInitialized : 1;
static bool bIsInDrag;
......@@ -265,8 +263,6 @@ private:
AutoTimer aUpdateTimer;
OUString aContextStrings[GLOBAL_CONTEXT_COUNT];
ImageList aEntryImages;
SwWrtShell* pActiveShell;
SvTreeListEntry* pEmphasisEntry; // Drag'n Drop emphasis
SvTreeListEntry* pDDSource; // source for Drag'n Drop
......@@ -277,7 +273,6 @@ private:
bool bIsInternalDrag :1;
bool bLastEntryEmphasis :1; // Drag'n Drop
bool bIsImageListInitialized : 1;
static const SfxObjectShell* pShowShell;
......
......@@ -25,7 +25,6 @@
class SwContentType;
// synchronize order and number with ResIds!!
enum class ContentTypeId
{
OUTLINE = 0,
......
......@@ -145,7 +145,6 @@
#define RES_FRMEX_MENU (STR_AUTH_FIELD_END + 1)
#define IMG_NAVI_ENTRYBMP (RC_UTLUI_BEGIN + 4)
#define ILIST_DB_DLG (RC_UTLUI_BEGIN + 6)
#define IMG_VIEWLAYOUT_AUTOMATIC (RC_UTLUI_BEGIN + 12)
......@@ -155,9 +154,21 @@
#define IMG_VIEWLAYOUT_SINGLECOLUMN (RC_UTLUI_BEGIN + 16)
#define IMG_VIEWLAYOUT_SINGLECOLUMN_ACTIVE (RC_UTLUI_BEGIN + 17)
#define IMG_PAGE_BREAK (RC_UTLUI_BEGIN + 18)
#define RID_BMP_DROP_REGION (RC_UTLUI_BEGIN + 19)
#define RID_BMP_DROP_LINK (RC_UTLUI_BEGIN + 20)
#define RID_BMP_DROP_COPY (RC_UTLUI_BEGIN + 21)
#define RID_BMP_NAVI_OUTLINE (RC_UTLUI_BEGIN + 19)
#define RID_BMP_NAVI_TABLE (RC_UTLUI_BEGIN + 20)
#define RID_BMP_NAVI_FRAME (RC_UTLUI_BEGIN + 21)
#define RID_BMP_NAVI_GRAPHIC (RC_UTLUI_BEGIN + 22)
#define RID_BMP_NAVI_OLE (RC_UTLUI_BEGIN + 23)
#define RID_BMP_NAVI_BOOKMARK (RC_UTLUI_BEGIN + 24)
#define RID_BMP_NAVI_REGION (RC_UTLUI_BEGIN + 25)
#define RID_BMP_NAVI_URLFIELD (RC_UTLUI_BEGIN + 26)
#define RID_BMP_NAVI_REFERENCE (RC_UTLUI_BEGIN + 27)
#define RID_BMP_NAVI_INDEX (RC_UTLUI_BEGIN + 28)
#define RID_BMP_NAVI_POSTIT (RC_UTLUI_BEGIN + 29)
#define RID_BMP_NAVI_DRAWOBJECT (RC_UTLUI_BEGIN + 30)
#define RID_BMP_DROP_REGION (RC_UTLUI_BEGIN + 31)
#define RID_BMP_DROP_LINK (RC_UTLUI_BEGIN + 32)
#define RID_BMP_DROP_COPY (RC_UTLUI_BEGIN + 33)
//local ids of the Database ImageLists
#define IMG_COLLAPSE 18002 /*RID_SVXIMG_COLLAPSEDNODE*/
......
......@@ -4033,31 +4033,26 @@ static Any lcl_GetDisplayBitmap(const OUString& _sLinkSuffix)
OUString sLinkSuffix = _sLinkSuffix;
if(!sLinkSuffix.isEmpty())
sLinkSuffix = sLinkSuffix.copy(1);
ContentTypeId nImgId(ContentTypeId::UNKNOWN);
bool bNotFound = false;
sal_uInt16 nImgId(0);
if(sLinkSuffix == "outline")
nImgId = ContentTypeId::OUTLINE;
nImgId = RID_BMP_NAVI_OUTLINE;
else if(sLinkSuffix == "table")
nImgId = ContentTypeId::TABLE;
nImgId = RID_BMP_NAVI_TABLE;
else if(sLinkSuffix == "frame")
nImgId = ContentTypeId::FRAME;
nImgId = RID_BMP_NAVI_FRAME;
else if(sLinkSuffix == "graphic")
nImgId = ContentTypeId::GRAPHIC;
else if(sLinkSuffix == "region")
nImgId = ContentTypeId::REGION;
nImgId = RID_BMP_NAVI_GRAPHIC;
else if(sLinkSuffix == "ole")
nImgId = ContentTypeId::OLE;
nImgId = RID_BMP_NAVI_OLE;
else if(sLinkSuffix.isEmpty())
nImgId = ContentTypeId::BOOKMARK;
else
bNotFound = true;
if(!bNotFound)
nImgId = RID_BMP_NAVI_BOOKMARK;
else if(sLinkSuffix == "region")
nImgId = RID_BMP_NAVI_REGION;
if (nImgId)
{
ImageList aEntryImages( SW_RES(IMG_NAVI_ENTRYBMP) );
const Image& rImage = aEntryImages.GetImage( (int)nImgId + 2000 );
Bitmap aBitmap( rImage.GetBitmapEx().GetBitmap() );
aRet <<= VCLUnoHelper::CreateBitmap( aBitmap );
aRet <<= VCLUnoHelper::CreateBitmap(BitmapEx(SW_RES(nImgId)).GetBitmap());
}
return aRet;
}
......
......@@ -797,7 +797,6 @@ SwContentTree::SwContentTree(vcl::Window* pParent, SwNavigationPI* pDialog)
, m_bIsLastReadOnly(false)
, m_bIsOutlineMoveable(true)
, m_bViewHasChanged(false)
, m_bIsImageListInitialized(false)
, m_bIsKeySpace(false)
{
SetHelpId(HID_NAVIGATOR_TREELIST);
......@@ -1531,13 +1530,61 @@ IMPL_LINK_NOARG(SwContentTree, ContentDoubleClickHdl, SvTreeListBox*, bool)
return false;
}
void SwContentTree::Display( bool bActive )
namespace
{
if(!m_bIsImageListInitialized)
BitmapEx GetBitmapForContentTypeId(ContentTypeId eType)
{
m_aEntryImages = ImageList(SW_RES(IMG_NAVI_ENTRYBMP));
m_bIsImageListInitialized = true;
}
sal_uInt16 nResId(0);
switch (eType)
{
case ContentTypeId::OUTLINE:
nResId = RID_BMP_NAVI_OUTLINE;
break;
case ContentTypeId::TABLE:
nResId = RID_BMP_NAVI_TABLE;
break;
case ContentTypeId::FRAME:
nResId = RID_BMP_NAVI_FRAME;
break;
case ContentTypeId::GRAPHIC:
nResId = RID_BMP_NAVI_GRAPHIC;
break;
case ContentTypeId::OLE:
nResId = RID_BMP_NAVI_OLE;
break;
case ContentTypeId::BOOKMARK:
nResId = RID_BMP_NAVI_BOOKMARK;
break;
case ContentTypeId::REGION:
nResId = RID_BMP_NAVI_REGION;
break;
case ContentTypeId::URLFIELD:
nResId = RID_BMP_NAVI_URLFIELD;
break;
case ContentTypeId::REFERENCE:
nResId = RID_BMP_NAVI_REFERENCE;
break;
case ContentTypeId::INDEX:
nResId = RID_BMP_NAVI_INDEX;
break;
case ContentTypeId::POSTIT:
nResId = RID_BMP_NAVI_POSTIT;
break;
case ContentTypeId::DRAWOBJECT:
nResId = RID_BMP_NAVI_DRAWOBJECT;
break;
case ContentTypeId::UNKNOWN:
SAL_WARN("sw.ui", "ContentTypeId::UNKNOWN has no bitmap preview");
break;
}
return BitmapEx(SW_RES(nResId));
};
}
void SwContentTree::Display( bool bActive )
{
// First read the selected entry to select it later again if necessary
// -> the user data here are no longer valid!
SvTreeListEntry* pOldSelEntry = FirstSelected();
......@@ -1596,9 +1643,9 @@ void SwContentTree::Display( bool bActive )
OUString sEntry = (*ppContentT)->GetName();
SvTreeListEntry* pEntry;
const Image& rImage = m_aEntryImages.GetImage(SID_SW_START + (int)nCntType);
Image aImage(GetBitmapForContentTypeId(nCntType));
bool bChOnDemand = 0 != (*ppContentT)->GetMemberCount();
pEntry = InsertEntry(sEntry, rImage, rImage,
pEntry = InsertEntry(sEntry, aImage, aImage,
nullptr, bChOnDemand, TREELIST_APPEND, (*ppContentT));
if(nCntType == m_nLastSelType)
pSelEntry = pEntry;
......@@ -1647,9 +1694,9 @@ void SwContentTree::Display( bool bActive )
&m_aHiddenContentArr[m_nRootType];
if(!(*ppRootContentT))
(*ppRootContentT) = new SwContentType(pShell, m_nRootType, m_nOutlineLevel );
const Image& rImage = m_aEntryImages.GetImage(20000 + (int)m_nRootType);
Image aImage(GetBitmapForContentTypeId(m_nRootType));
SvTreeListEntry* pParent = InsertEntry(
(*ppRootContentT)->GetName(), rImage, rImage,
(*ppRootContentT)->GetName(), aImage, aImage,
nullptr, false, TREELIST_APPEND, *ppRootContentT);
if(m_nRootType != ContentTypeId::OUTLINE)
......@@ -3521,7 +3568,6 @@ void SwContentTree::DataChanged(const DataChangedEvent& rDCEvt)
{
FindActiveTypeAndRemoveUserData();
m_bIsImageListInitialized = false;
Display(true);
}
......
......@@ -145,7 +145,6 @@ SwGlobalTree::SwGlobalTree(vcl::Window* pParent, SwNavigationPI* pDialog)
, pDocInserter(nullptr)
, bIsInternalDrag(false)
, bLastEntryEmphasis(false)
, bIsImageListInitialized(false)
{
SetDragDropMode(DragDropMode::APP_COPY |
DragDropMode::CTRL_MOVE |
......@@ -622,13 +621,8 @@ void SwGlobalTree::Clear()
SvTreeListBox::Clear();
}
void SwGlobalTree::Display(bool bOnlyUpdateUserData)
void SwGlobalTree::Display(bool bOnlyUpdateUserData)
{
if(!bIsImageListInitialized)
{
aEntryImages = ImageList(SW_RES(IMG_NAVI_ENTRYBMP));
bIsImageListInitialized = true;
}
size_t nCount = pSwGlblDocContents->size();
if(bOnlyUpdateUserData && GetEntryCount() == pSwGlblDocContents->size())
{
......@@ -673,14 +667,14 @@ void SwGlobalTree::Display(bool bOnlyUpdateUserData)
{
const SwTOXBase* pBase = pCont->GetTOX();
sEntry = pBase->GetTitle();
aImage = aEntryImages.GetImage(SID_SW_START + (int)ContentTypeId::INDEX);
aImage = Image(Bitmap(SW_RES(RID_BMP_NAVI_INDEX)));
}
break;
case GLBLDOC_SECTION:
{
const SwSection* pSect = pCont->GetSection();
sEntry = pSect->GetSectionName();
aImage = aEntryImages.GetImage(SID_SW_START + (int)ContentTypeId::REGION);
aImage = Image(Bitmap(SW_RES(RID_BMP_DROP_REGION)));
}
break;
}
......@@ -1244,7 +1238,6 @@ void SwGlobalTree::DataChanged( const DataChangedEvent& rDCEvt )
if ( (rDCEvt.GetType() == DataChangedEventType::SETTINGS) &&
(rDCEvt.GetFlags() & AllSettingsFlags::STYLE) )
{
aEntryImages = ImageList(SW_RES(IMG_NAVI_ENTRYBMP));
Update(true);
}
SvTreeListBox::DataChanged( rDCEvt );
......
......@@ -24,25 +24,64 @@
#include "helpid.h"
#include "access.hrc"
ImageList IMG_NAVI_ENTRYBMP
{
Prefix = "nc";
IdList =
{
20000 ;
20001 ;
20002 ;
20003 ;
20004 ;
20005 ;
20006 ;
20007 ;
20008 ;
20009 ;
20010 ;
20011 ;
};
IdCount = { 12 ; };
Bitmap RID_BMP_NAVI_OUTLINE
{
File = "nc20000.png" ;
};
Bitmap RID_BMP_NAVI_TABLE
{
File = "nc20001.png" ;
};
Bitmap RID_BMP_NAVI_FRAME
{
File = "nc20002.png" ;
};
Bitmap RID_BMP_NAVI_GRAPHIC
{
File = "nc20003.png" ;
};
Bitmap RID_BMP_NAVI_OLE
{
File = "nc20004.png" ;
};
Bitmap RID_BMP_NAVI_BOOKMARK
{
File = "nc20005.png" ;
};
Bitmap RID_BMP_NAVI_REGION
{
File = "nc20006.png" ;
};
Bitmap RID_BMP_NAVI_URLFIELD
{
File = "nc20007.png" ;
};
Bitmap RID_BMP_NAVI_REFERENCE
{
File = "nc20008.png" ;
};
Bitmap RID_BMP_NAVI_INDEX
{
File = "nc20009.png" ;
};
Bitmap RID_BMP_NAVI_POSTIT
{
File = "nc20010.png" ;
};
Bitmap RID_BMP_NAVI_DRAWOBJECT
{
File = "nc20011.png" ;
};
Bitmap RID_BMP_DROP_REGION
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment