aknlayoutcompiler/src/MLCompData.cpp
changeset 1 b700e12870ca
parent 0 f58d6ec98e88
equal deleted inserted replaced
0:f58d6ec98e88 1:b700e12870ca
    24 
    24 
    25 #include "LayoutCompilerErr.h"
    25 #include "LayoutCompilerErr.h"
    26 #include "CodeGenConsts.h"
    26 #include "CodeGenConsts.h"
    27 #include "UsefulDefinitions.h"
    27 #include "UsefulDefinitions.h"
    28 
    28 
    29 #include "Akndef.hrh"
    29 #include <AknDef.hrh>
    30 
    30 
    31 #include <set>
    31 #include <set>
    32 #include <sstream>
    32 #include <sstream>
    33 #include <iostream>
    33 #include <iostream>
    34 #include <algorithm>
    34 #include <algorithm>
   189 	if(iLine) // screen contents isn't contained in a line
   189 	if(iLine) // screen contents isn't contained in a line
   190 		{
   190 		{
   191 		int thisSize = size();
   191 		int thisSize = size();
   192 		int numVarieties = iLine->MaxVariety() + 1; // get zero based index
   192 		int numVarieties = iLine->MaxVariety() + 1; // get zero based index
   193 		int maximum = max(numVarieties, thisSize);
   193 		int maximum = max(numVarieties, thisSize);
   194 		int maxMulti;
   194 		unsigned int maxMulti;
   195 		switch(TMLCompDataValues::Type(aCellName))
   195 		switch(TMLCompDataValues::Type(aCellName))
   196 			{
   196 			{
   197 			case ECellTypeCol:
   197 			case ECellTypeCol:
   198 				maxMulti = iLine->NumCols();
   198 				maxMulti = iLine->NumCols();
   199 				break;
   199 				break;
   292 //  TMLCompDataLine
   292 //  TMLCompDataLine
   293 //
   293 //
   294 
   294 
   295 TMLCompDataLine::TMLCompDataLine()
   295 TMLCompDataLine::TMLCompDataLine()
   296 :	iId(0),
   296 :	iId(0),
   297 	iIsUnique(true), 
   297 	iName(KCompDataUnknown), 
   298 	iIsMirroredHorizontally(false),
       
   299 	iType(EUnknownComponent),
   298 	iType(EUnknownComponent),
   300 	iName(KCompDataUnknown),
       
   301 	iDrawingOrder(-1),
   299 	iDrawingOrder(-1),
   302 	iMaxVariety(0),
   300 	iMaxVariety(0),
   303 	iParentTable(0),
   301 	iParentTable(0),
   304 	iParentInfo(0),
   302 	iParentInfo(0),
   305 	iAttributeInfo(0),
   303 	iAttributeInfo(0),
   306 	iNumCols(1),
   304 	iIsUnique(true),
   307 	iNumRows(1),
   305 	iGlobalIndex(0),
       
   306 	iIsMirroredHorizontally(false),
   308 	iNeedsOptions(false),
   307 	iNeedsOptions(false),
   309 	iNeedsCols(false),
   308 	iNeedsCols(false),
   310 	iNeedsRows(false),
   309 	iNeedsRows(false),
   311 	iGlobalIndex(0)
   310 	iNumCols(1),
       
   311 	iNumRows(1)
   312 	{	
   312 	{	
   313 		
   313 		
   314 	}
   314 	}
   315 
   315 
   316 TMLCompDataLine::TMLCompDataLine(const TMLCompDataLine& aOther)
   316 TMLCompDataLine::TMLCompDataLine(const TMLCompDataLine& aOther)
   443 	{
   443 	{
   444 	TMLAttributeZoomLevels* found = 0;
   444 	TMLAttributeZoomLevels* found = 0;
   445 	TMLCompData& data = *(iParentTable->iTables);
   445 	TMLCompData& data = *(iParentTable->iTables);
   446 	TMLAttributes& attributes = *(data.iAttributes);
   446 	TMLAttributes& attributes = *(data.iAttributes);
   447 	int attribId = attributes.iNames[aAttribName];
   447 	int attribId = attributes.iNames[aAttribName];
       
   448 
   448 	if(attribId == 0)
   449 	if(attribId == 0)
   449 		throw GeneralErr(string("Attribute name not found: ") + aAttribName);
   450 		throw GeneralErr(string("Attribute name not found: ") + aAttribName);
   450 	// find out from attribute info which attribute set we need
   451 	// find out from attribute info which attribute set we need
   451 	// but if there is none specified, we don't need to search
   452 	// but if there is none specified, we don't need to search
   452 	if(iAttributeInfo)
   453 	if(iAttributeInfo)
   848 // TMLCompDataTable
   849 // TMLCompDataTable
   849 //
   850 //
   850 
   851 
   851 TMLCompDataTable::TMLCompDataTable(TMLCompData* aTables)
   852 TMLCompDataTable::TMLCompDataTable(TMLCompData* aTables)
   852 	: 
   853 	: 
       
   854 	iId(0),
   853 	iTables(aTables), 
   855 	iTables(aTables), 
   854 	iParentLine(NULL), 
   856 	iParentLine(NULL),
   855 	iFirstLineGlobalIndex(-1), 
   857 	iNeedsP(false),
       
   858 	iNeedsIndex(false),
   856 	iAppend(false),
   859 	iAppend(false),
   857 	iId(0),
   860 	iFirstLineGlobalIndex(-1)
   858 	iNeedsP(false),
       
   859 	iNeedsIndex(false)
       
   860 	{
   861 	{
   861 	}
   862 	}
   862 
   863 
   863 TMLCompDataTable::TMLCompDataTable(TMLCompData* aTables, const TMLCompDataTable& aOther)
   864 TMLCompDataTable::TMLCompDataTable(TMLCompData* aTables, const TMLCompDataTable& aOther)
   864 	: 
   865 	: 
   865 	iTables(aTables), 
   866 	iId(aOther.iId),
       
   867 	iName(aOther.iName),
       
   868 	iTables(aTables),
       
   869 	iColumnNames(aOther.iColumnNames),
   866 	iParentLine(NULL), 
   870 	iParentLine(NULL), 
   867 	iFirstLineGlobalIndex(aOther.iFirstLineGlobalIndex), 
       
   868 	iAppend(aOther.iAppend), iColumnNames(aOther.iColumnNames), iName(aOther.iName),
       
   869 	iParentName(aOther.iParentName),
   871 	iParentName(aOther.iParentName),
   870   	iId(aOther.iId)
   872 	iAppend(aOther.iAppend),
       
   873 	iFirstLineGlobalIndex(aOther.iFirstLineGlobalIndex)
       
   874 
   871 	{
   875 	{
   872 	for (const_iterator pLine = aOther.begin(); pLine != aOther.end(); ++pLine)
   876 	for (const_iterator pLine = aOther.begin(); pLine != aOther.end(); ++pLine)
   873 		push_back(new TMLCompDataLine(**pLine));
   877 		push_back(new TMLCompDataLine(**pLine));
   874 	}
   878 	}
   875 
   879 
   910 		{
   914 		{
   911 		TMLCompDataSubTable& sub = **pSub;
   915 		TMLCompDataSubTable& sub = **pSub;
   912 		string subTableName = MLCompDataToCdl::SubTableApiName(sub);
   916 		string subTableName = MLCompDataToCdl::SubTableApiName(sub);
   913 		string subTableLimitsName = MLCompDataToCdl::SubTableLimitsApiName(sub);
   917 		string subTableLimitsName = MLCompDataToCdl::SubTableLimitsApiName(sub);
   914 		string paramLimitsName = MLCompDataToCdl::SubTableParamLimtsApiName(sub);
   918 		string paramLimitsName = MLCompDataToCdl::SubTableParamLimtsApiName(sub);
   915 		TMLCompDataLine& line = *((*this)[0]);
   919 		
   916 		// first check the lines for a direct match
   920 		// first check the lines for a direct match
   917 		// then try the param limits instead
   921 		// then try the param limits instead
   918 		if (subTableName == aName ||
   922 		if (subTableName == aName ||
   919 			subTableLimitsName == aName ||
   923 			subTableLimitsName == aName ||
   920 			(sub.NeedsParams() && paramLimitsName == aName)) // need to check whether the subtable needs params
   924 			(sub.NeedsParams() && paramLimitsName == aName)) // need to check whether the subtable needs params
  1062 	return KVerticalNamesSet.find(aName) != KVerticalNamesSet.end();
  1066 	return KVerticalNamesSet.find(aName) != KVerticalNamesSet.end();
  1063 	}
  1067 	}
  1064 
  1068 
  1065 
  1069 
  1066 const string KPaneColumnNames[] = {"Item", "C", "l", "t", "r", "b", "W", "H", "Remarks"};
  1070 const string KPaneColumnNames[] = {"Item", "C", "l", "t", "r", "b", "W", "H", "Remarks"};
  1067 const string KGraphicColumnNames[] = {"Item", "C", "l", "t", "r", "b", "W", "H", "Remarks"};
       
  1068 const string KTextColumnNames[] = {"Font", "C", "l", "r", "t", "b", "W", "H", "J", "Remarks"};
       
  1069 
  1071 
  1070 void TMLCompDataTable::SetDefaultColumnNames()
  1072 void TMLCompDataTable::SetDefaultColumnNames()
  1071 	{
  1073 	{
  1072 	iColumnNames.clear();
  1074 	iColumnNames.clear();
  1073 	iColumnNames.insert(iColumnNames.end(), KPaneColumnNames, ARRAY_END(KTextColumnNames)); // superset
  1075     iColumnNames.insert(iColumnNames.end(), KPaneColumnNames, ARRAY_END(KPaneColumnNames));
  1074 	}
  1076 	}
  1075 
  1077 
  1076 TMLCompDataTable::TMLCompDataSubTable::TMLCompDataSubTable()
  1078 TMLCompDataTable::TMLCompDataSubTable::TMLCompDataSubTable()
  1077 : 
  1079 : 
  1078 	iNeedsOption(false),
  1080 	iNeedsOption(false),
  1230 				{
  1232 				{
  1231 				TMLCompDataParentInfo& parentInfo = *(line.iParentInfo);
  1233 				TMLCompDataParentInfo& parentInfo = *(line.iParentInfo);
  1232 				TMLCompDataParentInfoSelector& selector = (parentInfo.begin())->second; // we ignore the varieties for now
  1234 				TMLCompDataParentInfoSelector& selector = (parentInfo.begin())->second; // we ignore the varieties for now
  1233 				parentId = selector.iParentId;
  1235 				parentId = selector.iParentId;
  1234 				TMLCompDataTable* parentTable = FindTable(parentId);
  1236 				TMLCompDataTable* parentTable = FindTable(parentId);
  1235 				TMLCompDataLine* parentLine = iComponents[parentId];
  1237 
  1236 				if(parentTable)
  1238 				if(parentTable)
  1237 					{
  1239 					{
  1238 					line.iParentTable = parentTable;
  1240 					line.iParentTable = parentTable;
  1239 					// copy the pointer from the components table
  1241 					// copy the pointer from the components table
  1240 					parentTable->push_back(&line);
  1242 					parentTable->push_back(&line);